ST. LOUIS (AP) -- Jason Michaels just wanted to have a good at-bat.
He couldn't have done any better.
Michaels hit a tying pinch-hit grand slam in the seventh inning and Jason Bay drove in the winning run an inning later as the Pittsburgh Pirates rallied for a 5-4 victory over the St. Louis Cardinals on Monday night.
"I tried to keep it simple," said Michaels, who had a pinch-hit, three-run double on Friday against the Cardinals. "Just get myself in a good count and put a good swing on the ball."
Michaels, batting for Raul Chavez, hit his first home run of the season against starter Adam Wainwright for just the second hit of the inning. The two-out shot was his first homer with the Pirates and his first since hitting one against Texas on Aug. 1, 2007, while with Cleveland.
Wainwright (5-3) allowed just one single to Jack Wilson through five innings and faced the minimum after getting Freddy Sanchez to ground into a double play. Signs of trouble started showing in the sixth during which the Pirates got two two-out singles, but Wainwright escaped without allowing a run.
He then gave up a double to Bay and walked two to bring up Michaels in the seventh.
"It's a really difficult game to lose for us and for him," St. Louis manager Tony La Russa said. "A couple of walks and a bomb."
In the eighth, Nate McLouth singled to center and advanced to second on a sacrifice by Wilson. Bay broke the tie one out later with a single to right field.
"It's kind of been the character of this team that I think we lacked in years past," Bay said. "Too many times we've come close but been unable to close them out."
Wainwright gave up seven hits, struck out four, walked two in eight innings. Four of the Pirates' hits against the Cardinals starters came in the seventh and eighth.
"I figured it was our one shot," Pittsburgh manager John Russell said of using Michaels. "We hadn't had any guys on base. We hadn't had much offense to speak of at all... fortunately that one inning worked out for us."
The Cardinals' starter said he was still baffled by what happened against Michaels after the game. He said he felt like he could "pitch 12 innings" and there was no cause for his problems in the seventh.
"I can't explain it," Wainwright said. "You just can't give up a grand slam right there. It's the worst I've ever felt after a game."
Tom Gorzelanny struggled at the start the game, giving up two runs on three hits in the first and third innings, using 62 pitches -- including 30 in the third. From there, he allowed a bloop single from Wainwright before being pulled to start the seventh.
"We did a terrific job of getting four runs," La Russa said. "We had innings to add to it and we kept getting zeros."
Michaels' pinch-hit slam was the first for Pittsburgh since Craig Wilson hit one against Milwaukee in 2003. ... Xavier Nady, who was 6-for-13 coming in against Wainwright, went 0-for-3 with a walk ending his eight-game hit streak. ... McLouth received a prolonged ovation from the crowd after making a dazzling catch to take away a possible triple from Aaron Miles in the first.