ST. LOUIS -- A Pirates team quickly becoming known for its comebacks pulled off one of the season's unlikeliest on Monday night.

The outcome wasn't looking promising with the game down to the final three innings, the deficit looming at four, and an opposing pitcher on the mound who had no-hitter type stuff through six innings.

But as Jason Bay quickly reminded reporters postgame, throw all the probabilities and suppositions out the window with this team, as the way the club fought back for a 5-4 victory over the Cardinals is becoming more and more the norm, if it's accurate to call these late-inning rallies such.

"It's kind of been the character of this team that I think we've lacked in years past, that we've come back in games," said Bay, whose tie-breaking RBI single in the eighth proved to be the ultimate difference maker. "That's been the biggest thing from teams past to this year, is the late-inning character that we have."

Before getting to how this one ended, the context of how it started is necessary.

It started with Cardinals pitcher Adam Wainwright cruising, allowing just one hit in five innings. His pitch total at that point -- a mere 46.

"He was throwing an outstanding game," manager John Russell said. "I wasn't sure we were going to get anything off of him."

Two sixth-inning singles by the Bucs amounted to nothing, and though Tom Gorzelanny had settled down after a rocky start, the Pirates' fate seemed all-but-sealed with the 4-0 deficit they took into the seventh.

"Through five innings you look up and we hadn't even put up a fight," Bay said. "I'm sure there was a point where some people were thinking that it's not looking good."

It would be Bay who connected for the first squarely hit ball of the night and found himself at second with a one-out double in the seventh. Xavier Nady followed with a walk before Jose Bautista also drew a free pass to load the bases with two outs.

With light-hitting catcher Raul Chavez due up, Russell called on Jason Michaels to pinch hit in his place.

"I figured that was our one shot," Russell said. "We hadn't had any guys on base. We hadn't had much offense to speak of. We were talking about it on the bench and just thought that that inning was going to be our one shot."

Michaels had been called upon in a similar bases-loaded, four-run-deficit situation on Friday and answered with a three-run double. Despite the two walks that came before him, Michaels said he stepped to the plate intending to be aggressive, looking for a first-pitch fastball.

"I just wanted to get a good pitch to hit," said Michaels, who came into the game hitting .306 since being acquired by the Pirates. "I'm not trying to hit home runs. I'm trying to go up and have a good at-bat."

He'd get that fastball on the first pitch he saw, sending it into the Pirates bullpen.

"It wasn't down the middle by any means, but it was a good pitch to hit -- too good in that situation," Wainwright said. "The wheels completely came off."

The grand slam was the third of Michaels' career, and his first home run this season. It was the second grand slam of the series for the Bucs, and also marked the first pinch-hit grand slam for Pittsburgh since Craig Wilson did so back in July 2003.

"These guys did a good job battling and getting on base," Michaels said. "I'm just trying to get on and keep it going and get the next guy on base. It worked out."

With the game tied, it wouldn't take long for the Pirates to cap their eighth win of the season in a game in which they trailed after seven innings. Nate McLouth led off the eighth with his second hit of the night, advancing to second on Jack Wilson's sacrifice bunt and then scoring standing up when Bay guided a 2-1 slider form Wainwright into right field for his third game-winning RBI in the last nine games.

Gutsy efforts from Franquelis Osoria, Damaso Marte and Matt Capps, who picked up his first save since May 17, sealed the team's second win of the four-game set. It also kept Gorzelanny from enduring what would have been his team-leading sixth loss.

Gorzelanny came into the game looking for redemption after being rocked for six runs in less than an inning in his last start, and things started ominously when the left-hander allowed two runs in both the first and third innings.

"He looked like he was trying to find himself a little bit," Russell said. "With the way it started, it didn't look like he might be able to get that far."

Pirates reliever Bryan Bullington was ready after warming up in the bullpen in the third, but when Russell decided to stick with Gorzelanny, the lefty made sure he made the most of the extra opportunity.

Gorzelanny appeared to get stronger as the game progressed, finishing the outing by allowing just one hit and one run in three more innings. By doing so, he kept the deficit at a manageable four runs and finally finished a game without such a sour taste.

"It was big," Gorzelanny said. "I needed a good performance today, and I felt that it was positive today. It's definitely a step in the right direction. But I'm definitely not satisfied."