SAN FRANCISCO - The San Diego Padres arrived in San Francisco with some nice momentum, then faced the division rival and defending World Series champions in serious need of some.
San Diego nearly turned a triple play that certainly would have helped the cause.
Instead, Angel Pagan lined a game-ending double to right field with one out in the ninth inning, and the San Francisco Giants returned from a rough road trip to beat the Padres 3-2 on Friday night.
Luke Gregerson (1-2) gave up Gregor Blanco's leadoff bloop single to shallow left to start the rally, then pinch-hitter Andres Torres reached on a fielder's choice after an unsuccessful sacrifice bunt attempt and stole second before coming home on Pagan's hit. It was Pagan's first game-winning hit since last July 1 against the Reds — also a double.
"The middle part of the game he locked in," Padres manager Bud Black said. "He got it together and we couldn't really get anything going."
Chase Headley hit a tying, two-out homer in the sixth just over leaping left fielder Blanco. The tying run kept Bumgarner from becoming the first Giants pitcher to win his first four starts since Tim Lincecum in 2010.
After San Diego hit three home runs Wednesday against Dodgers ace Clayton Kershaw, Headley's first clout of 2013 gave the Padres home runs in eight of their last nine games. But San Diego had its three-game winning streak snapped on a night it nearly turned a triple play on Bumgarner's double-play grounder in the sixth but the pitcher reached first.
"For a moment I thought it might work," Black said. "But Bumgarner gets down the line pretty good."
Headley also had a first-inning sacrifice fly for San Diego. Buster Posey then added one of his own in the bottom half to tie the game at 1.
Blanco wound up with three hits, Pagan and Brandon Belt with two apiece, and San Francisco had its speedsters together for the winning push.
Hurt by some bad luck on hard-hit balls during the road trip, Blanco vowed to do anything he could to get on base in the ninth.
"Back in Milwaukee I hit the ball several times hard, and today I got two hits with half-swings," he said. "I don't really practice it to tell you the truth. I just try to use my speed."
So did Torres with the heads-up steal.
"It was huge," Pagan said.
Pence's third-inning double scored Posey for the Giants' first lead in 27 innings since their previous advantage in the third inning at Milwaukee on Tuesday. The Giants were swept by the Brewers for a season-high three-game skid.
Thousands of fans in the sellout crowd of 41,559 at AT&T Park were late arrivals on fireworks night because of long lines and extra security that included the use of electronic scanning wands.
In the eighth inning, they were treated to "Sweet Caroline" as a tribute to Boston. An American flag waved, and several fans sported Red Sox shirts.
"That's touching, it is, with what's happened there in Boston," Giants manager Bruce Bochy said. "We are certainly thinking of the victims there. It's a tragedy. It's nice to honour Boston and their courage."
Padres starter Edinson Volquez, the winning pitcher in the semifinals for the World Baseball Classic champion Dominican Republic here last month, allowed two runs in six innings and remained winless in four starts.
He allowed two runs and eight hits in six innings, struck out three and walked three.
"I think I've got a better tempo now, a better rhythm between pitches," he said. "I'm trying to keep the ball down and throw more strikes."
Guzman doubled and singled for San Diego, but the Padres' lineup that had previously had success against Bumgarner got shut down. San Diego's active position players came into Friday batting .290 (38 for 131) with 12 doubles, two triples, five homers and 21 RBIs against the left-hander.
Five of the last six Padres losses have been by two or fewer runs and three of those were decided by one run — including three straight.
Crawford went 0 for 4 with two strikeouts to have a career-best 11-game hitting streak snapped along with a 14-game stretch of reaching base safely.
A moment of silence was held both for the Boston victims and the wife of Hall of Famer Willie Mays, Mae Louise Allen Mays, who died in her sleep Friday morning at age 74 following a long fight with Alzheimer's disease.
NOTES: Padres RHP Tyson Ross injured his non-throwing shoulder getting his first major league hit vs. Clayton Kershaw on Wednesday. Manager Bud Black said it could affect next start. "He's sore," Black said. "If you ask Tyson, he thinks he can pitch. He wants to pitch. I wouldn't say it's definite he'll start." ... The division rivals met for the first of 19 games. The Giants won last season's series 12-6 and are 25-12 in the matchups over the past two years.