Jaime Garcia allowed two runs and struck out seven in seven-plus innings for the injury-riddled Cardinals, who held their half-game lead over Cincinnati in the NL Central. St. Louis has won just three of its last 11.
Clayton Richard got the first out in the eighth before the Padres went to the bullpen. Yadier Molina hit a broken-bat single with one out off Andrew Cashner (2-3) and with two outs, Greene homered to right-center for his third hit.
Jason Motte (3-1) allowed Guzman's two-run double in the eighth for his second blown save in three chances, but finished off the win.
Yonder Alonso had two hits for the Padres, who are a major league-worst 4-11 on the road after dropping the first game of a 10-game trip.
Guzman's go-ahead hit came against the fourth pitcher St. Louis used in the eighth. Marc Rzepczynski, who gave up Scott Van Slyke's go-ahead three-run homer in Sunday's loss at Los Angeles, walked Alonso, the only batter he faced, on four pitches.
Garcia's third career balk, and first this season, was costly in the second. Alonso went to second after hitting a leadoff single, then advanced on a groundout before scoring on Nick Hundley's sacrifice fly.
Manager Mike Matheny let Garcia hit in the seventh with one out, a man on second and the Cardinals down by a run. Garcia came through with an infield hit, beating out a grounder deep in the hole that shortstop Andy Parrino gloved but followed with a late, offline throw.
Rafael Furcal busted a 1-for-14 slump with a single to tie it and Garcia scored the go-ahead run on Matt Carpenter's groundout.
Garcia intentionally walked eighth-place hitter Parrino to load the bases in the seventh before striking out Richard to end the threat. Richard struck out all three at-bats and is 1 for 20 on the season with a single and 13 strikeouts.
Earlier in the seventh, Alexi Amarista just missed on a squeeze bunt attempt barely foul down the third-base line before striking out.
Garcia lasted just one more batter, departing after Chris Denorfia doubled to start the eighth. He struck out seven, giving him 16 in 14 1/3 innings his last two outings.
Notes: Cardinals 3B David Freese, in a 3-for-34 slump with all three hits in the same game, got a day off to work on his stroke. ... Richard is a career .122 hitter (14 for 117) with four doubles, nine RBIs and 46 strikeouts. ... The Padres were an inning shy of their first three-game winning streak.
Link to boxscore: St. Louis 4, San Diego 3