SAN FRANCISCO -- It took Giants All-Star catcher Buster Posey nearly four years to get his first career game-ending home run. Guillermo Quiroz did it in his first season with the defending World Series champs.
Of course, it helped facing a pitcher Quiroz was very familiar with.
One day after Posey's milestone hit in the series opener against the Dodgers, Quiroz matched him with a home run off Dodgers closer and former teammate Brandon League with one out in the 10th inning, lifting San Francisco to a 10-9 win over Los Angeles on Saturday night.
"He hung a split-finger fastball," said Quiroz, who played with League in Toronto and Seattle. "I know him pretty well. ... So I kind of knew what kind of pitch he was trying to get me out with."
The Giants blew a 5-0 lead and wasted a bases-loaded opportunity in the ninth before Quiroz hit an 0-2 pitch from League (0-1) into the left field stands. Quiroz pumped his fist as soon as he left the batter's box and scurried around the bases with his first career game-ending hit.
He is 4 for 6 this season as a pinch hitter after making the club as a bit of a long shot in spring training.
"I wasn't expecting a home run off a tough closer like that," San Francisco manager Bruce Bochy said. "For (Quiroz) to do that is impressive. Good for him. That's the ending of a wild game. They did a good job of coming back but so did we."
Santiago Casilla (3-2) pitched two innings for the victory.
The two teams used 12 pitchers and combined for 19 runs, 30 hits and stranded 24 runners in a game that lasted 4 hours, 11 minutes.
San Francisco needed every bit of it to record its 11th comeback victory of the season -- tops in the majors.
A.J. Ellis homered and was one of six Dodgers with two hits as Los Angeles lost for the fifth time in seven games.
"Tonight, in a sense, is encouraging," Dodgers manager Don Mattingly said. "It was as good as you can feel about a loss as you can."
Both teams had a chance to win it in the ninth.
Los Angeles got a one-out single from Dee Gordon but failed to advance him past second, while the Giants loaded the bases before Posey hit into an inning-ending double play.
The Dodgers haven't had a good time at all in the first two games of this series.
One day after left-hander Ted Lilly went on the disabled list, Los Angeles lost shortstop Hanley Ramirez to a hamstring injury less than a week after his return from an offseason thumb injury. Then first baseman Adrian Gonzalez was a late scratch with neck pain.
San Francisco, on the other hand, won its fifth straight.
Gordon put the Dodgers up 9-8 in the seventh when he drew a leadoff walk against Javy Lopez and was sacrificed to second. Gordon stole third and scored on a headfirst slide into home to beat the throw from San Francisco second baseman Marco Scutaro following Carl Crawford's infield grounder.
Pablo Sandoval's sacrifice fly in the bottom of the seventh tied it at 9-all.
The Giants batted around in the first inning and led 5-0 after two to chase Dodgers starter Matt Magill. Posey had a two-run double to help the defending World Series champs take their early lead.
Ellis homered off San Francisco starter Ryan Vogelsong with one out in the fourth before Los Angeles sent 12 men to the plate and took the lead in the fifth.
After Andres Torres ended an 0-for-14 slump with a solo home run off reliever Javy Guerra in the fifth to pull the Giants within 8-7 and Posey scored the tying run on a wild pitch by Paco Rodriguez in the sixth.
The two teams traded runs in the seventh, setting the stage for the finish.
Giants CF Angel Pagan left the game after the fifth inning with a right hamstring strain. ... San Francisco's starting pitchers haven't recorded a win since April 21, the team's longest drought since a 14-game stretch in 2010. ... Magill threw 43 pitches in the first inning. ... Injured Dodgers pitcher Zack Greinke threw a 60-pitch bullpen session in his latest step back from a broken left clavicle. "He felt like he had a lot more left, so that was good," Mattingly said. ... LHP Hyun-Jin Ryu (3-1), who starts the series finale for Los Angeles, is coming off a 12-strikeout performance against Colorado. He'll oppose San Francisco RHP Matt Cain (0-2), who is seeking his first win of the season.