SAN FRANCISCO -- First, it was about overcoming another rough Ryan Vogelsong start. Then, it was about overcoming the Dodgers' fill-in shortstop.
Finally, it was about pinch-hitter Guillermo Quiroz.
A poorly pitched, back-and-forth classic rivalry game Saturday evening ended with Quiroz's walk-off solo home run and what mattered most for the Giants: a win, 10-9, over the Dodgers at AT&T Park.
Quiroz had not played since April 24 and never had a walk-off hit in the Majors. But he had played with Dodgers closer Brandon League in previous career stints in Toronto and Seattle.
With one out in the bottom of the 10th, Quiroz smashed League's 0-2 split-finger fastball to the left-field stands. He raised his right fist as soon as he ran out of the batter's box.
"It felt great," Quiroz said. "... I hit it pretty good. He hung a split-finger fastball. The one before was pretty nasty; it just ran down. I knew League pretty well. I kind of knew what pitch he was trying to get me out with."
The victory for the Giants (18-12) extended their winning streak to five games and provided an opportunity for a sweep Sunday of the Dodgers, who dropped to 13-16.
It was a game the Giants led 6-1 going into the fifth and were behind 8-6 at the end of the inning; a game the Giants tied in the sixth and seventh innings; a game in which speedy Dodgers shortstop Dee Gordon reached base three times, hit a go-ahead two-run triple in the fifth and scored a go-ahead run in the seventh; and a game devoid of a 1-2-3 inning until the bottom of the eighth.
Vogelsong, who tossed 4 2/3 innings and allowed nine hits, seven runs and two walks with four strikeouts, was asked to summarize his outing.
"Crazy," he said. "Just like the whole game."
It followed Friday's series-opening walk-off win, that one courtesy of Buster Posey's homer, his first walk-off. Quiroz's blast not only netted a promise of free dinner from Posey, but it gave the Giants their 11th come-from-behind win this year, as well as their eighth home run (out of 24) that's tied a game or helped them go ahead.
The last time a Giant hit a pinch-hit walk-off homer? July 18, 2000, by Armando Rios.
"I don't think any of us expected him to hit a home run," manager Bruce Bochy said of Quiroz. "It's the ending of a wild game, an emotional game, a roller coaster that both teams were on."
The Giants and the Dodgers had 15 hits each, and both sides had many chances to win, whether it was Los Angeles, which did not trail after its seven-run fifth until Quiroz's homer, or the Giants, who had bases loaded and Posey at the plate with one out in the ninth. Posey grounded into an inning-ending double play.
The Giants were 5-for-17 with runners in scoring position, while the Dodgers were 6-for-13.
San Francisco reliever Santiago Casilla (3-2) earned the win by allowing just one hit and no runs in his two frames, the ninth and 10th.
Neither starter shined. While Vogelsong raised his ERA from 6.23 to 7.20, Dodgers starter Matt Magill lasted just 1 1/3 frames, doomed by a four-run, 43-pitch first inning. He allowed five runs, six hits and four walks and struck out two.
Magill was making only his second career start -- he debuted April 27 -- but Vogelsong is in an admitted funk, which he says he has almost every season.
"It's a battle," Vogelsong said. "Every pitch is like I'm battling myself."
Added Bochy: "I wanted to keep him in, but I was concerned. He was hitting his spots, then he lost it."
What the Giants found in this game was that, yet again, their comeback spirit is alive, even with a player like Quiroz, who was the last hitter left on the bench.
"Was it a perfect split? No. Was he seeing the split? Yeah," League said. "Obviously, I want that pitch back. But I didn't make him look too good on the 0-1 split, so of course I tried to throw it again. I hung one out of 12 that I threw. He got me."
Willie Bans is a contributor to MLB.com. This story was not subject to the approval of Major League Baseball or its clubs.