Pirates 3, Diamondbacks 2: Pinch hitter Ike Davis capped a ninth-inning rally with a one-out RBI single as host Pittsburgh ruined a terrific performance by Wade Miley.Miley was three outs away from his first victory since May 10, striking out 10 while facing one batter over the minimum through the first eight innings before allowing back-to-back singles by Neil Walker and pinch hitter Gregory Polanco to start the ninth. Addison Reed (1-4) came on and retired Josh Harrison before Starling Marte delivered a tying two-run double and scored the winning run on Davis' base hit two batters later.Jordy Mercer broke up Miley's perfect game with a two-out infield single in the fifth and Russell Martin also recorded a hit for the Pirates, who improved to 4-1 on their 10-game homestand. Ernesto Frieri (1-0) picked up the win despite yielding three hits in one scoreless inning in relief of Jeff Locke, who gave up two runs and eight hits over eight frames.Miguel Montero and Aaron Hill recorded a hit and an RBI apiece for the Diamondbacks, who fell to 2-2 on their nine-game road trip. Paul Goldschmidt went 2-for-3 and scored a run, David Peralta added a pair of hits and Miley allowed two runs and four hits as his winless streak reached nine starts.Arizona had a runner at third in each of the first two innings but wasn't able to get on the board until it staged a two-out rally in the fifth. Goldschmidt singled and stole second before scoring on a base hit by Montero, who took second on the throw and came home on Hill's base hit.GAME NOTEBOOK: The Diamondbacks received good news regarding SS Chris Owings, whose MRI showed no structural damage to his left shoulder. Manager Kirk Gibson said Owings likely will begin hitting in a week. ... Pirates LHP Francisco Liriano (oblique) is slated to throw a four-inning simulated game on Wednesday. ... Pittsburgh improved to 9-27 when outhit in a game.