PHOENIX (AP) -- The Arizona Diamondbacks scored six runs, got six decent innings from their starter and appeared to be on the cusp of avoiding a sweep.
A couple of walks and a home run later, they were scratching their heads after the bullpen blew a third straight game.
David Hernandez gave up a three-run homer to Brandon Belt in the eighth inning for Arizona's majors-leading 10th blown save, sending the Diamondbacks to a hard-to-take 9-6 loss to the San Francisco Giants on Wednesday night.
"This is a tough time. It's a tough game," Diamondbacks manager Kirk Gibson said. "We just have to pick ourselves up."
Belt hit a two-run single off Brad Ziegler in the opener and Pablo Sandoval hit a two-run homer off Arizona closer J.J. Putz on Tuesday.
Belt finished off the series of comebacks with his homer off David Hernandez (1-2), giving San Francisco its first road sweep over the Diamondbacks since July 22-25, 2010.
Angel Pagan led off the game with a homer, Hunter Pence added a 460-foot solo shot and George Kontos (2-1) pitched 1 2-3 innings after starter Tim Lincecum struggled.
Sergio Romo extended his scoreless streak against Arizona to 27 innings in the ninth for his 11th save, finishing off San Francisco's ninth come-from-behind victory of the season.
"These guys have been amazing with these comebacks," Giants manager Bruce Bochy said. "They come through when we need them."
Just like it did the series' first two games, Arizona got off to a solid start.
Chad Pennington hit a three-run homer off Lincecum in the second inning and added a run-scoring double, matching his career-high with four RBIs.
The Diamondbacks had 15 hits after getting 11 the previous two games combined.
Brandon McCarthy put Arizona in position to win with six decent innings.
But Hernandez couldn't hold a 6-4 lead.
He walked Pence and Gregor Blanco in the eighth, then served up an 0-2 pitch that Belt hit out to right, setting off a round of boos from the home fans before the ball even landed. It was Arizona's majors-leading 10th blown save of the season.
"Walks are always going to hurt you," Hernandez said. "I still had a chance to make a pitch and just didn't do it."
McCarthy got his sixth start with Arizona off to a rough start, giving up a homer for the fourth straight game when Pagan hit his second pitch over the wall in right.
The right-hander gave up two more runs in the fifth inning on a run-scoring double by Pagan and Brandon Crawford's RBI triple. Pence hit the first pitch he saw in the sixth to the deepest part of Chase Field, a get-out-of-here quick solo shot to right-center that pulled the Giants with 5-4.
"That was a missile," Bochy said.
Even after Pence's monster shot, McCarthy still left with the lead, up 6-4 after Pennington's run-scoring double in the sixth.
McCarthy gave up four runs on eight hits with six strikeouts.
"Most innings I felt good. I just didn't change gears fast enough," said McCarthy, who matched Brandon Webb's 2005 team record by allowing eight hits for the sixth straight game. "That has been kind of the story there. It is still something that as I am getting adjusted, it is taking me a little too long to make the adjustments."
Lincecum had his own problems.
Pennington hit his first homer of the season off the right-hander in the second inning, a three-run shot to the pool deck in right-center. A.J. Pollock used his speed to set up another run in the fourth inning, reaching on an infield single, stealing second, then scoring on Eric Chavez's run-scoring double to make it 4-1.
Paul Goldschmidt followed with a bloop single to center in the fifth inning that put Arizona up 5-3.
Lincecum was lifted for a pinch hitter in the sixth after allowing five runs on 10 hits with six strikeouts.
"I could have done better hitting some spots," Lincecum said. "Balls were falling in here in there that I didn't like, but if I execute pitches and keep them down in the zone better, I'll fare better next time out."
Turns out, it would good enough for the never-out-out-of-it Giants.
Belt took advantage of Hernandez's two walks with his homer in the eighth and San Francisco tacked on two more in the ninth off Heath Bell to close out its road trip at .500 after losing the first three games.
Notes: Lincecum hasn't beaten Arizona since Sept. 29, 2010. ... McCarthy had gone 71 straight batters without a walk before intentionally putting Brandon Belt on in the second inning. ... The Giants have won seven of their last eight games at Chase Field. ... The Diamondbacks move on for a three-game road series against San Diego, with left-hander Wade Miley starting Friday. He is 2-0, but has had three straight no-decisions. ... The Giants are off Thursday before starting a three-game home series against the Dodgers. Barry Zito will face Los Angeles left-hander Clayton Kershaw in the opener.
© 2013 The Associated Press. All rights reserved. This material may not be published, broadcast, rewritten or redistributed.