PHOENIX -- A sore elbow couldn't slow Pablo Sandoval.
The San Francisco third baseman hit a two-run homer with one out in the top of the ninth inning and the Giants rallied to beat the Arizona Diamondbacks 2-1 on Tuesday night.
Sandoval was taken out of the Giants' win Monday by manager Bruce Bochy after hitting a tying RBI single in the fifth inning because of discomfort in his right elbow. After Tuesday's game, his right arm was wrapped in ice from his forearm to shoulder, but the pain couldn't erase his wide smile.
"I don't want to come out of the game," Sandoval said. "But he made a good point and said, `I'd rather lose you for two at-bats than for three weeks.' "Today, I came out and felt good, less pain. I told Bochy I want to play. I don't want to come out. I just want to play."
Sandoval also singled in the fourth against Arizona starter Trevor Cahill and is 11 for 17 in his past four games.
"He's swinging good," Bochy said. "When you get a good hitter like that in the zone, it's fun to watch. We weren't sure he was going to play, but he shows up, says he fine, and ends up swinging the bat well."
Cahill left after allowing a leadoff single to Angel Pagan, the Giants' fourth hit against the right-hander. J.J. Putz (2-1) came on for Arizona and struck out Marco Scutaro, and quickly went ahead 0-1 on Sandoval.
But Sandoval drove Putz's next pitch, a hanging split-finger fastball, deep into the right-field stands to give the Giants the lead and hand the struggling Diamondbacks closer his fourth blown save in nine chances.
"It seems like every time I leave one of those up it's getting crushed right now," Putz said. "It's frustrating. I made some pretty good pitches on Scutaro, some good pitches on (Buster) Posey (following Sandoval). The one to Sandoval just didn't come out of my hand right."
It was San Francisco's second straight come-from-behind victory, rallying for a 6-4 win in the series opener Monday.
Josh Wilson had given the Diamondbacks a 1-0 lead with a home run in the bottom of the eighth off Santiago Casilla, who had come on after Madison Bumgarner threw seven scoreless innings. It was Wilson's first homer since June 25, 2011, for Milwaukee at Florida.
The late-inning power display was in sharp contrast to the game's first 7 1/2 innings. Bumgarner allowed three hits, walked one and struck out two before giving way for a pinch hitter when his spot in the lineup came up in the eighth.
Cahill's line to that point was slightly better, with five strikeouts to go with the three hits and one walk through eight innings.
"I figured he would leave me in until I got somebody on," Cahill said. "It's real frustrating when it is so close and you can't finish it out. You're going to kick yourself even more than if you only went three and gave up 10 runs. It's a bad feeling."
Only two players had reached base during the game for either side, both in the fourth. Scutaro singled to lead off the inning for the Giants and went to third on a single and fielder's choice, while Martin Prado singled to start the bottom of the inning and advanced on a two-out single.
The pitchers' duel was nothing new for Cahill, who has pitched in only one game decided by more than two runs so far. In his last four starts, both teams have combined for an average of 4.0 runs per game, including a 1-0 victory over Los Angeles on April 14 in which Cahill earned a no-decision after trading zeroes with Josh Beckett for 7 1/3 innings.
Over his past two starts, Cahill has allowed two runs -- one earned -- on eight hits over 13 innings.
"I didn't want him to take the loss," said Arizona manager Kirk Gibson. "I had confidence in my closer and it didn't work out."
Bumgarner struck out two, threw 62 of 102 pitches for strikes and lowered his ERA to 1.55. He became the first Giants pitcher with at least six starts of two or fewer runs since Kevin Correia went seven such outings in 2007.
"It's probably been a little bit of everything," Bumgarner said. "The command's been there, the mechanics have been good and I've felt the same pretty much every time out. I think if you're feeling good and your mechanics are going good it doesn't matter if you have to sit down for a long inning or get up and down so much."
Arizona SS Didi Gregorius, who was hit in the head by a pitch from Colorado's Josh Outman on Friday and subsequently placed on the 7-day concussion list Sunday, passed all concussion exams Tuesday and was cleared to resume baseball activity. The rookie had appeared in seven games, going 11 for 27 with a pair of home runs. ... Giants manager Bruce Bochy said Scutaro will be given the day off Wednesday ahead of San Francisco's scheduled off day Thursday. ... Arizona signed OF Juan Rivera to a minor league contract. Rivera had been with the New York Yankees in spring training on a minor league deal after hitting .244 with nine homers and 47 RBIs for the Los Angeles Dodgers last season. ... The Diamondbacks traded minor league IF Mark Teahen to Cincinnati for a player to be named later. ... Giants LHP Jeremy Affeldt, eligible to come off the 15-day disabled list Wednesday, is scheduled to throw either during an extended spring game or for Class A San Jose and be reinstated Friday. ... Arizona RHP Brandon McCarthy will seek his first win with the Diamondbacks when he faces RHP Tim Lincecum and the Giants in the series finale Wednesday. Lincecum is 7-8 with a 3.44 ERA in 21 career starts against Arizona, but has lost his last six against the Diamondbacks dating to Sept. 29, 2010.