Shortstop Jack Wilson atoned for an earlier error by driving in the game-tying run in the ninth and the go-ahead run in the 15th on two sacrifice flies, and Pittsburgh ended its three-game losing streak with a 4-3 win over the Cubs at Wrigley Field.
"I think it was by far the worst game of my career," Wilson said, referring to his error. "Then I ended up getting those two sac flies."
Manager Jim Tracy, who had been ejected in the seventh for arguing a play at second, was more than pleased with his team's gutsy win.
"I don't think you can say enough about the job our starting pitcher, Ian Snell, did -- and obviously our bullpen," Tracy said. "It's a big, big win for us."
Jonah Bayliss (3-2), who picked up the win after pitching three scoreless innings in relief, joined his bullpen mates in shutting down the Cubs over the final seven innings.
"It took everything we possibly had in this ballgame tonight to get the four runs that we got," Tracy said. "The job that our pitching staff continues to do ... you can't give them enough credit."
The Bucs nearly took the lead twice in extra innings before the 15th.
In the 11th, Jason Bay singled to left with two outs and runners on first and second, but left fielder Alfonso Soriano threw out Don Kelly at the plate to end the inning.
Then in the 12th, Pittsburgh had the bases loaded with one out, but pinch-hitter Jose Castillo grounded into a 4-3 double-play, although it appeared he beat the throw to first, which would have allowed Xavier Nady to score the lead run.
And even though the Pirates didn't push across the run in those frames, there were some key pinch-hits that put the team in position to score.
"We got some very good at-bats from some guys off of our bench," Tracy said. "There's any number of guys out there in that room that contributed to this win."
The Pirates rallied to tie the game in the ninth at 3. With one out, pinch-hitter Nate McLouth walked, followed by a single from pinch-hitter Ryan Doumit that sent McLouth to third. Wilson then hit a sac fly to shallow right.
The Cubs got their first lead of the game in an eventful seventh. With one out, Cesar Izturis reached on the fielding error by Wilson. Following a single from pinch-hitter Daryle Ward, Soriano drove in Izturis on a single to left. Bay threw behind Ward rounding second, and while the throw appeared to beat him back to the bag, first-base umpire Tom Hallion called Ward safe. Tracy came out to argue and was ejected for the first time this season.
"It happens," Tracy said. "You move on.
"You're not so sure even now if Soriano was or was not tagged out. And the only thing that was discouraging when I did get ejected in the second case, I thought Daryle Ward was out. Tommy tried very hard to get over there in position to make the call, but he's in a very difficult position to make that call when he's in between first and second."
Snell pitched into the eighth, allowing two earned runs on 10 hits while striking out five and walking none.
Kerry Walls is a contributor to MLB.com This story was not subject to the approval of Major League Baseball or its clubs.