Miley, who did not finish the second inning in his last start, allowed two runs on five hits. He walked two and struck out three. He was left with a no-decision when the D-backs rallied for a couple of runs in the eighth inning.
"I was just trying to keep it at 2-0," Miley said. "That gave us a chance to tie it and push it into extra innings. I just want to go out and compete and give us a chance to win."
Eric Chavez and A.J. Pollock each drove in a run in the eighth against Santiago Casilla to tie the game. Pollock, who doubled in the first, was the only D-back to get farther than first base through the first seven innings against Giants starter Madison Bumgarner.
"We battled and scratched a couple of runs off some good pitchers," Pollack said. "We were hoping to get one more across."
Joe Thatcher (3-2), who had held the Giants scoreless in 13 of 15 previous games at AT&T Park, took the loss.
Thatcher never retired a batter. Hector Sanchez led off the 11th with a single and was promptly replaced by speedy pinch-runner Ehire Adrianza, who became a key factor in the win.
Gregor Blanco followed with a bunt, and Adrianza beat the force attempt at second, setting up Angel Pagan's game-winning single into left field.
The D-backs have not scored more than four runs in any game since beating the San Diego Padres, 10-9, on Aug. 27. They have averaged 2.2 runs in the past 11 contests.
"I think we scored eight runs in the four games here," Arizona manager Kirk Gibson said. "That puts a lot of pressure on the pitchers and guys threw the ball fairly decently for us. We have not swung the bats very well at all, especially in the good situations."
Matt Davidson walked to lead off the ninth but pinch-runner Tony Campana was caught leaning too far off first and was nailed in a rundown. In the 10th, Willie Bloomquist hit a one-out double. With two outs, Paul Goldschmidt was walked intentionally.
Aaron Hill hit a bouncer to first baseman Buster Posey and was originally called safe when pitcher George Kontos was ruled to have missed touching the bag, though first-base umpire Tom Hallion eventually reversed his call after discussing the play with his crew. Gibson argued and was ejected.
"We're not in a good streak right now," Gibson said. "Part of it is baseball, part of it is pitching. It's part of the game. We'd certainly like to be better than we've shown."