And to think, an hour before Eugenio Velez laced his walk-off single up the middle against Hong-Chih Kuo, Manny Ramirez had come perilously close to ruining the day for Matt Cain and his teammates.
With a 3-2 lead in the seventh, Cain surrendered a heater to Ramirez that the slugger lined to center field to score a pair of runs. Cain said he tried throwing the pitch inside but it ended up over the heart of the plate.
A one-run lead turned into a one-run deficit. For nearly two innings, a deflating loss seemed assured.
But Randy Winn opened the ninth with a single to right field and Aaron Rowand followed with a single of his own. Then the youth took over.
Jose Castillo hit what should have been a double-play ball to end the game, but Casey Blake botched the play. Emmanuel Burriss scored Winn with a groundout to second base and beat the throw to first to avoid another potential game-ending double play.
Then, with "Beat L.A." chants filling the air, the rarely used Velez hit the game-winning single that barely slipped through Kuo's legs.
"I was on first literally telling myself, pumping myself up for him ... 'Just hit it on the ground, somewhere on the ground,'" said Burriss of Velez's at-bat. "If he could do that, I was pretty confident I could make it to second. And there's always a good chance if he hits the ball on the ground, he could beat it out."
Asked whether he thought the Dodgers would get him on his own hit, Burriss simply said, "No shot."
That confidence is now prevalent inside the Giants' clubhouse.
Sure, they're all but out of the playoff race. But they just stuck it to the Dodgers in consecutive games. They've won 10 of their past 18 and they're nearly .500 (21-22) in National League West play.
None of the Giants' statistical feats would be considered impressive for a playoff team. The Giants, though, were expected to lose 100 games.
"It's a good sign when the club isn't giving up," said Winn, whose three hits and three RBIs added to his already impressive homestand stats (13-for-25). "Even when we fall behind, we still battle and battle, and it's paid off the last two nights.
"Each person does their job, you keep the line moving and we did that."
Cain did his job brilliantly for the first 6 2/3 innings. He allowed only two runs and five hits before surrendering Ramirez's double on his 119th pitch.
In the past several weeks, Cain's found a groove, maintaining a 1.26 ERA over 35 2/3 innings before Sunday's game. For a while, he seemed in line for his first win against the Dodgers -- he's 0-5 against them in nine career starts.
Regardless of who got the decision (Jack Taschner, one inning, two strikeouts), Cain was pumped about beating the Dodgers the past two nights, keeping them from grabbing the NL West lead.
"There's nothing greater than that," Cain said. "It's always pretty fun to walk the Dodgers off the field. It's good to kind of give it back to them."
Not two weeks ago, Los Angeles starter Chad Billingsley gave it to the Giants with a shutout. He dominated San Francisco, allowing just five hits in a 4-0 victory.
On Sunday, the Giants made Billingsley work, taking ball after ball, forcing him out after six innings and 116 pitches.
Dave Roberts, Rowand, Winn and Ivan Ochoa each had multiple hits, leading to a run in the first and two in the third.
For a while, all that offense seemed wasted. Then the Giants came back.
"It's been awhile since we've done that," manager Bruce Bochy said. "To come back these last two games and get great wins like this, it does so much for the spirit, the mood of a ballclub, the sense of confidence that goes throughout that clubhouse and how important it is to fight for nine innings."