Derrek Lee hit a grand slam against his 5 victory game set.
Lee was activated from the 15-day disabled list prior to the game and had three hits and knocked in five runs as Pittsburgh won its second straight game on the heels of a five-game losing streak.
"It was good perseverance by this team," Lee said.
The Pirates were able to pull out the win after both teams waited out a 91- minute rain delay in the seventh inning.
Carlos Marmol (2-5) blew his ninth save of the year by allowing Lee's slam to take the loss.
"I tried to do my best, but it didn't work out," Marmol said.
Alfonso Soriano went 2-for-3 with four RBI for Chicago, losers of three straight.
Ross Ohlendorf started the game for Pittsburgh and allowed three runs on seven hits and two walks through four innings, and Casey Coleman lasted six innings, allowing two runs -- one earned -- on six hits and three walks while striking out six in the start for Chicago.
Pinch-hitter Xavier Paul led off the ninth with a single to center. Two batters later, Jose Tabata worked a walk and after Marmol fanned Alex Presley, Andrew McCutchen also earned a free pass to load the bases with two outs. Marmol then hung a 1-1 slider over the middle of the plate and Lee, who played for the Cubs from 2004-2009, smacked it over the left-field wall for the game- deciding runs.
In his Pittsburgh debut on August 1, also against the Cubs, Lee was the deciding factor in the game, going 2-for-4 with two home runs and three RBI. He was hit on the wrist by Marmol in the series finale on August 3, fracturing a bone in his left wrist and causing his stint on the DL.
Presley hit a one-out double in the first inning, advanced to third on a passed ball by catcher Geovany Soto and came home on a first-pitch, base hit to left by Lee, giving the Pirates a quick, one-run advantage.
The Cubs failed to bring home a run with the bases loaded in the first inning, but were able to break through in the third. Aramis Ramirez singled with one out, moved to third on a double down the first-base line by Carlos Pena and crossed the plate on Soriano's sacrifice fly to center field.
The Cubs loaded the bases with no outs in the fifth on a Darwin Barney single and consecutive walks to Ramirez and Pena. Soriano then plated Barney with a single to left and Ohlendorf was pulled in favor of Chris Leroux.
Leroux was able to limit the damage to just a run-scoring groundout to short by Byrd before getting Tyler Colvin out on a pop up to short and Soto on a fly out to center to make it a 3-2 game.
Pittsburgh tied the game in the seventh off of reliever Kerry Wood. Ronny Cedeno greeted Wood with a triple to right and came home the next batter on pinch-hitter Garrett Jones' sacrifice fly to center.
Daniel McCutchen started the bottom of the seventh for Pittsburgh and allowed a leadoff single to Ramirez and walked Pena before moving the runners to second and third on a wild pitch. Soriano then laced a two-run double into the left-field corner, putting the Cubs back on top.
McCutchen then hit Byrd with a pitch before being replaced by Resop on the bump. But after working a 2-2 count on Tyler Colvin, the game was delayed on account of rain.
When play restarted 91 minutes later, Resop fanned Colvin, induced a flyout to center by Soto and struck out pinch-hitter Blake DeWitt, keeping the score 5-3.
With wins in the first two games of this series, the Pirates have improved to 6-1 in their last seven series played at Wrigley Field...Pittsburgh now holds an 8-7 edge against Chicago in the season series...Chicago went 2-for-15 with runners in scoring position and left 12 men on base...Pittsburgh went 2-for-9 with runners in scoring position and stranded eight.