The Pirates scored four times in the fifth inning to take a 4-1 lead, and then fell victim to the long ball.
Parra's two-run homer in the fifth forged a 4-4 tie, Tracy finished off a five-run seventh with a three-run blast and Upton hit a two-run shot in the eighth.
Arizona starter Dan Haren missed out on a chance to win his 11th game when he gave up the four runs in the fifth.
Juan Gutierrez (3-2) picked up the victory by working a perfect seventh inning.
After Haren allowed nine base runners, Pittsburgh could not manage a hit against any of Arizona's four relievers.
Evan Meek (1-1) gave up the first two runs in the seventh to take the loss. He retired only two batters.
Pittsburgh was coming off two victories in three games against Milwaukee, a team that had beaten the Pirates 17 straight times heading into the series.