The shot, to the Crawford Boxes off Russ Springer on a 2-1 count, ended a 2-2 tie that had carried since the seventh. The ball fell just inside the back right corner of the boxes -- two feet to the right, and it would have been caught by the left fielder.
But the pitch before the blast was hit harder and better, hooking just foul to deep right field.
"He threw me two pitches in, which I knew he was probably going to try to work me in, and then on 2-0 I was just kind of cheating on a fastball inside," Berkman said of the at-bat against his former teammate. "I thought that was going to win the game, but it hooked just foul at the end.
"So then I thought, 'Well, he's been working in. It wouldn't surprise me if he threw a fastball away right here, so be ready to look out there.' I didn't hit it as good as that first one, but good enough to get in the Crawford seats, and I'll take it."
Berkman, 32, hit 285 home runs before recording the walk-off, marking the most career home runs without a walk-off for any active Major League player. It is his third walk-off hit of the season. The blast is the team's third walk-off home run of the season and the sixth walk-off win of the season.
The first baseman, who has played in 1,346 games, said he has thought about the statistic in passing, imagining it would be nice to remove the zero from that field, but he said he figured if he played long enough he would get one.
But nearly everyone in Minute Maid Park was surprised by the fact that the Astros' best hitter, and one of the best in the league, had never had a walk-off home run.
"I don't want to sound like a prophet, but I called that one," manager Cecil Cooper said. "I said, 'He's going to get his first walk-off.' Good for me."
Berkman's teammates huddled around home plate waiting for him to round the bases, and they all jumped on him and congratulated him as he stepped on the plate.
Berkman said they had been on him all season for not having the big hit, reminding him at every ninth-inning tie situation that all he needed was one good swing.
"That's a big moment," Cooper said. "You see all your teammates waiting for you at home plate, they mob you. You circle the bases and you know they're waiting on you. He's going to remember that one for a long time."
The Astros' other two runs came on a two-run homer to the right-field corner by David Newhan in the seventh inning. Hunter Pence beat the throw on a single to third base with two outs to bring up Newhan, who delivered his second deep shot of the season.
"[Cardinals pitcher Kyle Lohse] was tying me up all night, and I was able to get a fastball just a little bit more out over the plate than the ones he was throwing me earlier," Newhan said. "Sometimes you hit those balls and they hook. I was praying it would stay fair."
Said Lohse: "It cut. It was supposed to be a sinker and it was the only one all night that cut. Down and in, right to his hot spot." The St. Louis right-hander gave up seven hits while striking out six in eight innings.
Beyond the two home runs, the Astros were able to do little against Lohse, stranding three runners.
"I don't care who the Cardinals bring out there -- they could grab somebody out of the stands and he'd throw a good game against us," Berkman said. "It seems like everybody they run out there every time is tough. They don't make many mistakes, and they don't walk a lot of guys. They keep the ball away from where you like it, and that's what he did."
Randy Wolf had just as strong an outing for Houston, giving up one earned run on three hits in six innings.
But a double-error by the pitcher in the fourth inning caused him some embarrassment. He bobbled a soft grounder by Ryan Ludwick near the mound and grossly overthrew it to first base to advance the runner to second. He then walked Troy Glaus before a Yadier Molina double drove in the run.
"It didn't look very good," Wolf said. "I was just telling the guys I remember the day when I was able to hit and field my position, so I don't know what happened. I thought I still had a chance and just made a bad throw and cost us a run. I'm usually better than that. I usually field that ball and get the out there."
Wolf gave up the other run when Nick Stavinoha hit a ground-rule double in the sixth, reached third on a groundout by Albert Pujols, and scored on a sacrifice fly by Ludwick.
But Cooper said Wolf looked as good as he has seen the lefty since he joined the team.
"He battled them and deserved a little better fate than the way things turned out," Cooper said. "If the game had been a little different, as far as the score was concerned, we would have probably left him in there. He looked strong, he looked like he was really throwing well. He kept his fastball down in the strike zone, for the most part, and kind of stayed ahead of hitters."
But Cooper removed Wolf after the sixth for Chris Sampson, who struck out one with a hit in two innings. Doug Brocail recorded the win, giving up a hit to Pujols but throwing the slugger out on a double play.
Krysten Oliphant is an associate reporter for MLB.com. This story was not subject to the approval of Major League Baseball or its clubs.