The Phillies squandered a six-run lead before regaining the advantage on a pair of two-out hits. Philadelphia outhit the Cardinals 18-15 while ending a three-game St. Louis winning streak.
A two-run single by Galvis keyed Philadelphia's four-run first and the Phillies added two in the second on a double by Shane Victorino.
Philadelphia quickly moved back in front, however, getting one-out singles by Victorino and Ty Wigginton in the sixth off Fernando Salas (0-3). After John Mayberry popped up for the second out of the inning, Galvis and Fontenot came through with clutch, run-scoring singles.
Wigginton delivered what turned out to be the game-winning run with a solo shot in the eighth that gave Philadelphia a 10-8 lead.
Raul Valdes (1-0), making his fourth relief appearance since being called up this month, got the win by recording the final two outs in the fifth inning. Jonathan Papelbon gave up a one-out single in the ninth, but retired the next two batters for his 13th save.