While Greinke headed to the clubhouse before the inning ended, Miley settled down to earn his sixth victory in the Diamondbacks' 8-5 win over the Brewers on Saturday night.
John McDonald hit a three-homer for Arizona, while Gerardo Parra was 4-for-4 with a double, a walk and two runs. Parra also made a terrific grab running toward the wall in center of Norichika Aoki's deep fly ball in the ninth inning. Parra's four hits tied a career best.
Greinke (5-2), who had allowed one run total in his previous three starts, gave up seven runs and a season-high 10 hits in 2 1/3 innings.
Miley (6-1) gave up five runs -- three earned -- and eight hits in six innings for the victory. He finished with three scoreless innings after a shaky start, winning his third in a row.
"It's all about a team win," Miley said. "We've been struggling and we're just trying to turn it around."
Arizona won at home for only the third time in 13 games.
Miley, in winning his third straight appearance, finished with three scoreless innings after a shaky start. He also doubled and singled, improving his batting average to .444 (8 for 18).
Brad Ziegler and David Hernandez each pitched a hitless inning of relief before J.J. Putz, on his bobblehead night, pitched a perfect ninth for his 10th save in 13 tries -- surviving a pair of deep fly balls,
Cody Ransom, claimed by Milwaukee off waivers from Arizona on Wednesday, doubled in two runs. Aoki tripled and doubled for the Brewers.The Diamondbacks had 15 hits, two apiece by McDonald, Aaron Hill, Justin Upton, Jason Kubel and Miley.
Milwaukee, aided by third baseman Ryan Roberts' throwing error, scored four times in the third to go up 5-2.
Greinke, who was 4-0 in his previous six starts and hadn't lost since his second outing on April 12, never made it through the bottom half as Arizona scored five times.
"The third inning it really caught up to me, trying to be real nasty and walked some guys," he said, "trying to be better than I could really pitch. That is the main thing. I got out of my normal game plan."
Upton and Kubel started the inning with their second singles of the night. Paul Goldschmidt walked to load the bases, then Greinke forced in a run with a walk to Robert. Konrad Schmidt's fielder's choice brought in another run. On an 0-2 count, McDonald lined one just over the wall in left field, a three-run shot that made it 7-5.
"I think it was great, coming back after they scored four in the top," McDonald said. "For us to come back and score five for Wade, get him back out there and get him going. He seemed to take off from there. He seemed to settle in."
Miley singled, Parra walked, and that was it for Greinke in his shortest outing since he went two innings in a 12-2 loss at the Yankees last July 28. Greinke walked three and struck out three, allowing 13 baserunners in his brief performance.
"You get any pitcher in an extended inning, where you've got to throw a lot of pitches, and get guys on and get pressure on him, then you've got a chance to get to him," Diamondbacks manager Kirk Gibson said, "and we got to him tonight."
Arizona added a run in the seventh when Parra doubled and scored on Hill's two-out single.
Milwaukee scored in the first on Corey Hart's leadoff double and Jonathan Lucroy's two-out RBI single. Arizona responded with two in the bottom half when Parra, Hill, Upton and Kubel singled, all with no outs.
Before the game, the Diamondbacks announced catcher Miguel Montero had signed a $60 million, five-year contract covering 2013-17. Montero missed his fourth game in a row with a groin strain.
McDonald was 1-for-10 against Greinke entering the game. ... RHP Daniel Hudson (1-1, 6.00 ERA) is to come off the disabled list Sunday to start for Arizona in the series finale against Milwaukee LHP Randy Wolf (2-4, 6.02). Hudson has been out since April 21 with a right shoulder impingement. ... INF Ceaser Izturis (strained left hamstring) went on the 15-day DL after being injured running the bases on Friday night. ... Schmidt got his first major league RBI. ... Miley's single in the third extended his hitting streak to seven games, matching the franchise record for a pitcher. He also doubled in the fifth.