The Padres had forged a 3-2 lead in the top of the eighth when Jesse Motte (3-1) surrendered a two-run double to Jesus Guzman.
But the Cards came right back in the next half-inning when Yadier Molina collected a one-out single off Andrew Cashner (2-3) and one later Greene smacked the first pitch he saw over the right-center field fence for the decisive blow.
Rafael Furcal and Mike Carpenter added RBI for St. Louis, which maintained a half-game lead over Cincinnati atop the National League Central with the victory.
San Diego starter Clayton Richard yielded two runs on seven hits over 7 1/3 innings.
Celebrity Couples of 2014 [PHOTOS]