PHOENIX -- Built on pitching, San Francisco has seen its starters struggle at just the wrong time.
Cain gave up seven runs in 2 1/3 innings while losing his second successive start. No Giants starter has won since Barry Zito beat Colorado eight days ago. Still, the Giants 3.63 ERA remains second in the NL.
"As good as they've been, you know they are going to trip once in awhile. It so happens it's been the whole rotation here," San Francisco manager Bruce Bochy said.
"Our pitching right now is struggling, our starters, but they are fighting. We had the right guy out there. He was just off today. It's going to happen. The hitters were fighting to pick him up."
San Francisco (81-70) scored three runs in the ninth inning but did not put the potential tying run on base while falling into a with Atlanta behind Colorado (86-65).
"It's been bad. All of us have not done what we wanted to do," said Cain (13-7), whose ERA jumped from 2.71 to 2.99.
"It's very disappointing. I feel like I let a lot of guys down."
The Giants will not play NL West leader Los Angeles or any of the wild card contenders in their final 11 games.
"It makes things tougher, no getting around it. We know what's at stake," Bochy said.
Mark Reynolds, who struck out three times to break his own major league record with 206, also doubled in a run off Cain in a three-run second inning. It was his 100th RBI of the season.
"He just left a lot of balls over the plate. If you look at our hits, they are catching a lot of white" of the plate, Reynolds said. "Normally he is on the corners with his fastball and slider."
Arizona catcher Miguel Montero had three of Arizona's 16 hits and drove in two runs in Cain's shortest start of the season that was not curtailed by injury. He was removed in the second inning of a game July 11 against San Diego when he was hit in the arm by a line drive.
San Francisco built a 3-0 lead, the last two runs coming on Cain's first major league triple in the second inning, before Arizona scored three runs in its second and six more in the third to take a 9-4 lead.
Brandon Allen had two hits and two RBI for Arizona, which broke a three-game losing streak. Arizona (66-86) had won only four of its previous 17 games.
Pablo Sandoval had three hits and three RBI, and his two-run triple in the ninth inning off Juan Gutierrez cut Arizona's lead to 10-7. Sandoval scored on Randy Winn's sacrifice fly before Gutierrez retired the final two batters.
Sandoval has 18 hits in 34 at-bats at Chase Field this season.
Doug Davis (8-13) settled down after giving up four runs in the first two innings. He allowed 10 hits and five runs in 7 1/3 innings to win for the first time since Aug. 10. He was 0-3 with four no-decisions in his previous seven starts.
"It feels good. I have to hand it to our offense tonight. They battled back after I had a rough three innings," Davis said.
The umpires used instant replay to change the ruling on a hit originally called a two-run home run by Parra in the third.
With Montero on first base, Parra hit a fly ball to deep right-center field that appeared to land just beyond the fence near the 413-foot sign. First base umpire Marty Foster signaled a home run.
San Francisco center fielder Aaron Rowand immediately ran toward the infield to argue, and crew chief Wally Bell reversed the ruling after watching a replay that seemed to indicate the ball hit the top of the fence and bounced back onto the field.
Parra was given a double, but Montero was permitted to score.
- Johnson made his second relief appearance of the season for the Giants in the seventh inning, striking out three and giving up Ryal's third major league home run. It was Johnson's first relief outing in Chase Field since winning Game 7 of the 2001 World Series with one inning of work. Johnson got a small ovation from the crowd when he was announced.
- San Francisco second baseman Freddy Sanchez was unavailable Tuesday after suffering a knee injury Monday when he landed awkwardly while catching a return throw from the outfield in the top of the first inning of the Giants' 5-4 victory. "There is a little bit more of a tear in the meniscus," Bochy said after learning of the results of an MRI on Tuesday. "We'll rehab him. It is probably going to be a few days, if not more," before he can play.