PITTSBURGH -- An outstanding night took a sudden and unpleasant turn for Wade Miley and the D-backs as the Pirates rallied for a 3-2 win Tuesday night at PNC Park.
Heading into the bottom of the ninth, Miley was working on his first career shutout and the D-backs were up by a pair of runs.
And then the victory the D-backs thought was theirs evaporated amidst a three-run Pittsburgh rally.
"We gave all we could in the game and we don't feel good that we couldn't get this one, because it was taken out of our hands," D-backs outfielder Ender Inciarte said.
More like it was ripped out of their grasp by the Pirates.
Miley was on cruise control entering the ninth having allowed just two hits and striking out 10 through the first eight innings.
"He was in total command of that game," D-backs manager Kirk Gibson said.
Two straight hits, though, to lead off the inning prompted Gibson to bring in closer Addison Reed.
"In the ninth, I didn't make good pitches," Miley said. "I'd kind of been making pitches all night, but I didn't make them when I needed to. That's what happens. I felt very strong. I was trying a little too hard to make good pitches. I kind of left them up."
After retiring Josh Harrison, Reed got Starling Marte to wave at a pair of sliders off the outside edge of the plate.
Reed came back with another slider, but this one was down the middle and Marte doubled off the wall in center to score two runs and tie the game. Marte advanced to third when shortstop Nick Ahmed's relay throw got past catcher Miguel Montero.
"Terrible," Reed said of the pitch location. "It was an 0-2 count, missed my spot again. I was trying to get it away. I was trying to duplicate the second pitch, start it out on the black, outside corner and have it go out of the strike zone. And I hung it, left it right out over the middle of the plate and he's a good hitter, you can't do that to a guy like him and he put a good swing on it. The rest went from there."
The D-backs walked Andrew McCutchen to set up a double play and the Pirates sent up Ike Davis to hit for Gaby Sanchez.
After falling behind 1-0, Reed jammed Davis with a fastball, but Davis was able to still bloop the ball to right for a broken-bat game-winning single.
"He threw like a 92 mph cutter in off the plate -- and somehow I hit it," Davis said.
Right from the first inning it was apparent that Miley had his good stuff. The left-hander retired the first 14 batters he faced before Jordy Mercer collected an infield hit.
Miley picked right back up where he left off and retired the next seven batters.
Pirates starter Jeff Locke tossed a gem of his own in his sixth start since coming up from Triple-A.
Locke allowed two hits in each of the first and second innings, but managed to pitch his way out of both without the D-backs breaking through.
It was a two-out rally in the fifth that gave the D-backs the lead.
Paul Goldschmidt started it off with a single to left and proceeded to steal second. Montero followed with a groundball single through the right side before being able to move up to second on the throw to the plate trying to nail Goldschmidt.
That would prove important as it allowed Montero to score when Aaron Hill blooped a single down the first-base line for a 2-0 lead.
The D-backs missed a chance to add to the lead when Harrison threw out Gerardo Parra trying to score from second on Inciarte's single in the ninth.
"You've got to give them some credit on that," Gibson said. "Harrison did a good job of charging that ball."
Steve Gilbert is a reporter for MLB.com. Read his blog, Inside the D-backs, and follow him on Twitter @SteveGilbertMLB. This story was not subject to the approval of Major League Baseball or its clubs.