"It's always pretty fun to be able to walk the Dodgers off the field," Matt Cain said. "For these guys that are in contention, there's nothing better than to do that. They did it to us in '04."
Aaron Rowand, who had the game-winning hit Saturday, scored from third on Eugenio Velez's infield single to cap Sunday's comeback. Rowand finished with four hits while Randy Winn went 3-for-4 with three RBIs for the Giants, who won their third straight series for the first time since April 18-26, 2007.
"It's been a while since we've done that," San Francisco manager Bruce Bochy said. "The intensity that was here in this series and the crowd, you could hear them. Even when (we) came in after the eighth, the sense and feel in the dugout was 'Hey, we can do this.' They're fighting and that's all you can ask."
Hong-Chih Kuo allowed back-to-back singles to open the ninth, then got pinch-hitter Omar Vizquel to foul out to the catcher. Jose Castillo reached on an error by Los Angeles third baseman Casey Blake to load the bases.
Emmanuel Burris followed with an infield grounder, beating the throw to first from shortstop Angel Berroa and allowing Randy Winn to score the tying run. Velez's two-out single went through the legs of Kuo and bounced off the glove of Berroa, sending Rowand home.
"It's a feeling of if we don't get something started we're going to find ourselves in a long September, just being so far behind that we're not even playing for anything," Burris said. "We (had) an opportunity to make something happen with someone in front of us right in our own yard."
Jack Taschner (3-1) pitched one inning of relief to earn the win for the Giants. Kuo (3-2) took the loss after blowing a shot at his first career save in the majors.
Los Angeles had taken a 4-3 lead on Manny Ramirez's two-out, two-run double in the seventh inning. Ramirez, who was hit in the batting helmet by a pitch from Cain earlier in the game, fouled off a pair of pitches from Cain before lining the ball past San Francisco shortstop Ivan Ochoa. Kemp and Andre Ethier scored while Ramirez coasted into second.
The double off Cain was Ramirez's only hit of the game. He flew out twice and reached on a passed ball after striking out in the ninth. In nine games since being acquired in a trade from Boston on July 31, Ramirez is hitting .459 with two doubles, four home runs and 11 RBIs but the Dodgers are only 4-5 since he arrived.
"It's disappointing but it's going to happen," Los Angeles manager Joe Torre said. "We're going to have to reach down and reach back. It's how you come back."
Los Angeles starter Chad Billingsley, who pitched a shutout against the Giants on July 30, allowed nine hits and left with the lead after six innings.
Cain failed in his latest attempt at winning consecutive games for the first time this season. He walked four, giving him nine in his last two starts after going 16 consecutive innings without one.
Dave Roberts again provided an offensive spark for San Francisco. He came off the bench to key Saturday's win, and singled and scored in the first in this one. He scored again in the fourth when Winn hit a two-run single to make it 3-1.
Kemp tripled and scored in the fifth to pull the Dodgers within 3-2 before Ramirez put Los Angeles ahead with his double off Cain in the seventh.