In the fourth inning, the Diamondbacks' A.J. Pollock raced home on a passed ball and was called safe by home plate umpire Eric Cooper. Replays showed Giants pitcher Matt Cain appeared to tag Pollock before the runner crossed the plate.
But there was nothing Giants manager Bruce Bochy could do about it. He had used up his challenge moments earlier in a failed attempt to reverse a safe call on a pickoff attempt of Pollock at first.
"Good thing I made that play close at first," Pollock quipped. "It was all part of the master plan."
Even Arizona manager Kirk Gibson seemed to think Pollock should have been called out.
"It looked to me like it wasn't good for us," Gibson said, "but he called him safe."
Bochy already had been out of the dugout twice when he chose to challenge the pickoff play.
"What else are you going to do if you think they didn't get the call right?" he said. "Unfortunately they are not all going to go your way or get overturned, but that is the gamble you take. Sure there could be another play but you don't know that."
The run cut the Giants' lead to 4-3.
"He was out. I had him," Cain said. "I saw what Cooper saw. He saw that it looked like he went over the plate but he went through the top of my glove to go over it. `'
Pollock broke out of an 0-for-13 start to the season with three hits, scoring twice and driving in a run.
Wade Miley (1-1) gave up four runs in the first inning, and then blanked the Giants for the next six, retiring 15 in a row in one stretch
"The offense did a great job of kind of picking me up," he said. "I was down. I gave up the four-spot and was able to kind of overcome it. I knew if I just held it right there, we've got a pretty good lineup in here, and we'd have a pretty good chance to get back on top."
Gerardo Parra had two hits and the sacrifice fly that scored to the go-ahead run in the sixth inning.
Brandon Belt hit a three-run home run in the first, his second homer in as many games.
Addison Reed, who gave up the game-winning home run to Buster Posey Monday night, pitched a scoreless ninth for his first save with the Diamondbacks.
Pinch-hitter Hector Sanchez reached second with one out in the ninth when Arizona rookie shortstop Chris Owings misjudged a pop fly to short left and it dropped for a double. But Brandon Crawford fouled out to the catcher and Juan Perez struck out looking to end the game.
Pollock, dropped from the leadoff spot to No. 8 in the order, beat out an infield single in the first, singled and scored in the fourth, then doubled in a run and scored the go-ahead run in the sixth.
Paul Goldschmidt was 2 for 4 with an RBI double, extending his hitting streak to 23 games. Owings had two hits and a stolen base.
Juan Guiterrez (0-1) went two innings to take the loss in relief of Cain.
The Diamondbacks scored twice in the sixth to take the lead. Owings singled with one out, stole second and scored on Pollock's ground-rule double to left-center. Miley singled, an then Pollock scored from third on Parra's sacrifice fly to left, sliding in barely ahead of Perez's throw.
San Francisco jumped on Miley in a hurry. Singles by Angel Pagan, Pablo Sandoval and Posey brought in the first run. Then Belt hit Miley's 1-0 pitch into the swimming pool area in right field and it was 4-0.
Arizona got two in the bottom of the first. Parra led off with a single and came home on Goldschmidt's double to deep right-center. Goldschmidt scored on Martin Prado's single.
Cain left with a 4-3 lead after five innings. He gave up two earned runs, struck out two and walked two. Will Harris pitched a scoreless eighth for the Diamondbacks.