Milwaukee, which came into the series with a nine-game winning streak, salvaged the finale of the three-game set.
Peralta (2-0) allowed six hits and struck out three, and three relievers combined for scoreless relief.
Cardinals starter Joe Kelly (1-1) gave up an unearned run and three hits in four innings.