Juan Uribe's two-run homer off Jonathan Broxton completed a sequence of four home runs -- equaling another 2010 high -- that led San Francisco's rally from a 4-0 deficit in the final three innings.
Posey and Edgar Renteria supplied leadoff homers in the seventh and eighth innings, respectively, off Dodgers starter Ted Lilly. Pat Burrell added a pinch-hit clout off Octavio Dotel in the eighth.
After Cody Ross hustled his way into an infield single with one out in the ninth -- "That was probably the biggest play," Giants starter Matt Cain said -- Uribe propelled Broxton's 1-0 pitch into the left-center-field pavilion for his 18th homer of the season. Ten of those homers have either tied the score or put the Giants ahead.
"It's hard to get a bigger win at this stage," Giants manager Bruce Bochy said.
The Giants' 33rd comeback victory of the season left them two games behind San Diego, the reeling National League West leaders who have lost nine consecutive games. That's the second-place Giants' smallest deficit since they trailed the Padres by 1 1/2 games on Aug. 9. San Francisco remained three games behind Wild Card front-runner Philadelphia.
"Obviously, everybody in here is watching what's going on," Ross said, referring to the Giants' rivals in the standings. "But if we don't win, it doesn't matter."
The reversal in momentum was as extreme as it was dramatic. For six innings, the Giants' lone hit off Lilly was Aaron Rowand's double to open the game. After Lilly walked Aubrey Huff two batters later, he retired 17 of the next 18 Giants he faced.
"It was kind of dead in the dugout," Huff said.
Then the power went to work for the Giants, who entered the game tied for 10th in the league in home runs.
"That was kind of weird, using all home runs to score," Ross said. "We'll take it any way we can."
San Francisco actually set up its triumph in the eighth inning while failing to add a run. After the back-to-back homers by Renteria and Burrell narrowed Los Angeles' lead to 4-3, Dodgers manager Joe Torre summoned Hong-Chih Kuo, who retired Huff and Posey to strand pinch-runner Darren Ford on second base.
Kuo, whose injury history limits his durability, wasn't able to pitch the ninth. Torre believed that he had to stop the Giants in the eighth, however.
"Kuo is our closer," said Torre. "But if the game dictates that he needs to pitch in the eighth, that's what we do. Once we used him in the eighth, that took him out of play for the ninth. I felt it was still a no-brainer to put [Broxton] in that situation."
Broxton couldn't do anything about Ross' grounder, which shortstop Rafael Furcal corraled behind second base. Furcal quickly threw to first base, where Ross was called safe.
"Obviously in that situation, I'm trying everything I can to get on base," Ross said. "As soon as I hit it, and I see it going up the middle and Furcal make a play at it, I know I have to get down the line because he has an absolute cannon for an arm. It was a really close play and I beat it."
Uribe was mired in a 2-for-22 skid, but it was impossible to tell he was slumping when he connected with Broxton's pitch.
"It must have been uplifting for him," Bochy said.
"I got chills running around the bases," Ross said.
The scene quickly became nerve-racking for the Giants. Brian Wilson surrendered Casey Blake's leadoff single and Jamey Carroll's hit one out later, putting runners at the corners. Wilson responded by retiring Rod Barajas on a popup to shallow right field before pinch-hitter Reed Johnson hit a fielder's-choice grounder to third. That sealed Wilson's 39th save of the season and 125th of his career, tying him with Greg Minton for fourth on the all-time San Francisco list.
Asked how much stress the Dodgers' threat forced upon him, Bochy replied, "Willie's put me through this many times. We're kind of used to this."
Everything else, though, was blissfully unusual for the Giants.