Josh Harrison - who struck out four times the previous night - tripled, doubled and scored twice and the Pirates erupted in the final two innings to beat the Diamondbacks 9-4 on Friday night.
Pittsburgh scored the last nine runs, including eight in the eighth and ninth.'
It was the 27th comeback win for the Pirates.
''It's just what we do,'' Harrison said. ''We know we're not done 'til the last out.''
Arizona's All-Star Paul Goldschmidt was hit in the left hand by a pitch from Ernesto Frieri in the ninth inning. The hand was covered with a bandage afterward and Goldschmidt said he hadn't gotten the X-ray results.
''It's backyard baseball,'' Pittsburgh manager Clint Hurdle said. ''It's nothing spectacular. We just play.''
Tony Watson (8-1) pitched a scoreless eighth to get the win. Bo Schultz (0-1), recalled from Triple-A Reno on Tuesday, gave up all five in the ninth.
While some of Goldschmidt's teammates were suspicious he was hit on purpose, he didn't think so.
''Guys have to try and get outs. What do you want them to do? Just throw it down the middle? They pitch inside as a team. We do it too. We want our pitchers to be able to pitch inside. You don't want to see anyone get hurt but sometimes it may or may not happen.''
Ender Inciarte's three-run homer had helped Arizona take a 4-0 lead through five innings and Vidal Nuno appeared headed for his first victory in five starts since coming in the trade that sent Brandon McCarthy to the New York Yankees.
However, the Pirates battered the Arizona bullpen with 10 hits in the last two innings.
In the fifth, Arizona manager Kirk Gibson challenged a wild pitch call that ended up with Didi Gregorius on third, but with two outs. He won the challenge, the review determining that the batter Nuno was hit in the foot by the pitch. Two pitches later, with runners at first and second, Inciarte hit his second homer of the season, and his career, into the right field seats.
After the game was over, the Diamondbacks, upset that Goldschmidt had been hit, got into an argument with Martin about it. The dugouts emptied but no one did more than talk.
''I don't think anybody on their side was happy that Goldschmidt got hit,'' Hurdle said. ''It wasn't any intent on Ernesto's part. ... Nobody wants to hit a guy in that situation.''
Pirates: Right-hander Gerrit Cole, out since July 5 with shoulder fatigue, was scratched from his scheduled rehab start Saturday and will have a bullpen session instead. Outfielder Starling Marte, on the concussion list since July 23, will make a rehab start Saturday for Triple-A Indianapolis and could be back with the big league club within a week.
Diamondbacks: A.J. Pollock, on the DL with a fractured right hand since June 1, had one at bat and played center field in his first rehab game in the Arizona League. Infielder Cliff Pennington, out since June 2 with a sprained left thumb, is 8 for 29 (.421) in five rehab games with the Diamondbacks' Arizona League squad.
The Pirates can gain at least a split of the series with a win Saturday night.
Vance Worley (4-1, 2.54 ERA), coming off his first career shutout in a 5-0 win at Colorado, will try to stop the Pittsburgh skid. Rookie Chase Anderson (6-4, 3.34) goes for Arizona. He allowed one run on three hits in seven innings in his last outing, a no-decision at Cincinnati.
In Arizona's four-run fifth, Pittsburgh had a hit batter, throwing error by catcher Russell Martin, a wild pitch that scored a run, a throwing error and a walk.
Brent Morel, in his fourth start at third base since coming up from Triple-A Indianapolis, made a diving stop of Jordan Pacheco's grounder in the sixth. He got up and threw to first, where Gaby Sanchez stretched as far as he could to his right to make the catch for the out.
Goldschmidt was out of the starting ineup for only the second time in 109 games this season. He entered the game on a double-switch in the ninth.
TRIPLE-A DIAMONDBACKS: Five of Arizona's starters opened the season in the minor leagues.