The Pirates, who were 50 games below .500 coming into the series, picked up a triumph Friday when Ronny Cedeno drove in the winning run with a single in the bottom of the ninth for a 4-3 decision.
Esmerling Vasquez (1-6) took over on the mound in the home ninth with one out and nobody on. He walked pinch-hitter Andrew McCutchen and Ryan Doumit. Cedeno stepped to the plate and drove in McCutchen with a base hit to right.
Doumit and Neil Walker each hit solo homers for the Pirates, who had lost seven of eight. Jose Tabata added an RBI.
Brian Burres went seven innings in the start, allowing three runs -- two earned -- on seven hits. Evan Meek (5-4) recorded the final two outs in the top of ninth to pick up the win.
The 25-year-old James McDonald, a 2002 draft pick of the Los Angeles Dodgers, came to the Pirates earlier in the season after making four appearances with his old team.
He's started eight times with the Pirates since early August and is 3-4 with a 3.49 earned run average in 49 innings.
He's tossed 15 scoreless innings while allowing 10 hits in his two most recent starts, a home win over Atlanta and a tough-luck no-decision in the Pirates' 1-0 loss to the New York Mets.
McDonald faced the Diamondbacks five times with Los Angeles, going 1-2 with an 8.53 earned run average in 6 1/3 innings.
For Arizona, rookie righty Barry Enright makes his 15th start and tries to end a brief two-start skid.
He improved to 6-2 on the season with a seven-inning effort in a 5-2 defeat of San Diego on Sept. 1, but has since dropped verdicts to San Francisco and Cincinnati while allowing 16 hits and 11 runs in nine innings.
He is 2-1 in six road starts with a 3.38 ERA in 32 innings.
Enright has never faced the Pirates.
Arizona took two of three from the Pirates earlier in the year.