Leave, for a moment, the glee of sticky, champagne-soaked T-shirts and ear-to-ear grins that filled the visitors' clubhouse Wednesday night at Busch Stadium, and travel back several months. Pick the milestone dates in which the Houston Astros were overhauled, first from an explosive offense to a sleek small-ball machine, then from a team that rarely won to a team that rarely lost. Those red-letter days are Jan. 8, when center fielder Carlos Beltran moved on, eventually signing with the New York Mets, and May 24, when the rebuilt Astros lost to the Chicago Cubs, falling to 15-30 on the year.

"We overcame so much," third baseman Morgan Ensberg said after the Astros' 5-1 victory over the Cardinals sent them to their first World Series. "I think that's why this situation didn't bother us. We'd been through stuff all year, and we always got past it."

The situation Ensberg spoke of was only the Astros' latest hurdle, putting behind them the sting of Albert Pujols's game-winning home run in Game 5, and moving on to win two nights later, advancing to the World Series against the Chicago White Sox. But the qualities that allowed them to do so were developed long before Wednesday night.

Take, first, the Beltran transaction. The Astros traded with the Kansas City Royals midway through the 2004 season to acquire Beltran, and it was he, more than any other player, who injected the city with excitement during last year's playoffs, when he hit .435 with eight homers in 12 games, pushing the Cardinals to a seventh game of the NLCS. But when the price to retain him kept going up -- he signed with the Mets for seven years and $119 million -- the Astros decided to let their most dangerous offensive player go. The reaction at the time: Fine.

"First and foremost, I didn't necessarily think it was a big loss," Manager Phil Garner said. "One of my things that I feel is: If you put so much of your capital in any one player, it's going to hurt you. So I think it might have been a little bit of a blessing."

If it was a blessing, it became one only because the Astros then changed their offensive philosophy afterward. Their new center fielder would be 23-year-old Willy Taveras, who had a total of one major league at-bat prior to this season. But the Astros stuck him in there, knowing that if he could get on base, they might be able to create enough runs to let their stellar pitching staff take over.

"We knew we had to change, and we knew it the day after Carlos left," General Manager Tim Purpura said. "We knew we would have to find a way to push across some runs and not sit back and wait for a big blast. But I think, with Willy, we were comfortable that he could help us do that."

Taveras hit .291, stole 34 bases and scored 82 runs, all while roaming the spacious center field at Minute Maid Park and becoming a legitimate candidate for rookie of the year.

Still, there were major problems, and they started early. First baseman Jeff Bagwell -- who, along with second baseman Craig Biggio served as the face of the franchise for more than a decade -- came down with a nasty right shoulder problem, and by early May, he was on the disabled list, unable to return until September, and even then in a limited role. Bagwell played his last game in the midst of a six-game losing streak, one of three streaks at least that long the Astros suffered through during the first two months. They lost 21 of their first 23 games on the road, and when the Cubs scored four runs in the bottom of the eighth to come from behind for a 4-2 victory on May 24, they were 15 games below .500, the second-worst team in the National League.

Did they think they could turn it around?

"Honestly?" 43-year-old right-hander Roger Clemens said. "No. Of course not."

But Purpura, in his first season as the general manager, told his team he wasn't going to give up on the season, even as the heat of the Texas summer approached. On June 1, the Houston Chronicle ran a picture of a tombstone on the front page of its sports section under the headline, "Grave Circumstances." The text before the article read, "The cold, hard truth: It's off; Yes, there are 111 games left on the schedule, but the Astros might as well start thinking about next year."

"It made me mad," owner Drayton McLane said of the picture. "But maybe they did us a favor."

On that morning, the Astros were 19-32, a winning percentage of .373. Purpura told his team that he wouldn't rebuild, that the front office still intended to win this year. And somehow, they started to. On July 9, they beat the Dodgers to pull back to .500 at 43-43. After the 15-30 start, they played .632 baseball the rest of the way.

Saturday night, they will play in the first World Series game in the 44-year history of the franchise. They will do so not only because Roy Oswalt vanquished the Cardinals to end the NLCS, but because when their best offensive player moved elsewhere, they moved on, and after they played some of the worst baseball in the league, they responded with some of the best.