HOUSTON -- After St. Louis was swept by the Los Angeles Dodgers in late August, Cardinals manager Tony La Russa thought his team would fall short of the postseason once again.
Less than a month later, the Cardinals are tied with Atlanta for the NL wild-card lead.
The sliding Braves lost 7-1 to Philadelphia, sending the race for the NL's final playoff spot to the last day of the regular season. If the teams are tied after Wednesday's game, St. Louis will host a one-game playoff on Thursday night.
"Yeah, when we got swept by the Dodgers," La Russa said when asked if he doubted his team could make such a run. "When I saw our schedule I said: 'We could finish under .500 if we don't start getting it back together.' And we did."
St. Louis has won 21 of 29 games since that sweep, moving to the brink of what not so long ago seemed like an improbable goal.
"It's kind of fed us here the last few days, 120 years of baseball and this is one of those historic runs to tie," La Russa said. "But there's a different story between tying and finishing it off. So tomorrow we'll see if we can go take another step."
The Cardinals trailed 5-0 early and appeared to be headed for a second straight loss to the Astros. But St. Louis scored five times in the fourth and erased a 6-5 deficit with a four-run seventh.
Yadier Molina walked before Theriot hit his clutch triple to make it 8-6.
Nick Punto, who had four hits, doubled in Theriot in the seventh and had a solo homer in the ninth. Craig padded the lead with a three-run homer to the Crawford Boxes in left field in the eighth.
"You play all year for an opportunity to play in October," Theriot said. "So it's a good feeling to know that we put ourselves in a spot that we could possibly do that, to do what we've done this last month and keep playing."
Eduardo Sanchez (3-1) struck out two in 1 1/3 innings for the win in a game that included seven Cardinals relievers following an early exit by Jake Westbrook. It was Sanchez's first appearance since June 12 because of a shoulder injury.
Skip Schumaker drove in three runs in the fourth, and Berkman had three hits and scored three times. The crowd booed loudly when Berkman, the longtime Astros star, scored in the seventh.
The Astros jumped on Westbrook for seven hits and five runs in 2 1/3 innings to take the early lead.
Enerio Del Rosario (0-3) yielded two hits and three runs for the loss.
Craig then walked before Molina singled in a run and Schumaker cleared the bases with a double to center, chasing Sosa. David Carpenter came in and allowed Jon Jay's tying sacrifice fly later in the inning.
The Astros scored four times in the third. Brett Wallace had a two-run single and Paredes added a two-run triple that rolled up on the corner of Tal's Hill in center field.
Bogusevic was disappointed that Houston let its early advantage slip away.
"It's not over in the third or fourth inning, and we knew there was still a lot of baseball yet to be played," he said. "We tried to add on and hold them off, but it didn't work today."
Cardinals star Albert Pujols got hit on the right elbow by a ball that glanced off his bat for a foul in the seventh. He writhed in pain for a minute before trainers came and checked on him. He continued his at-bat after a short delay, flew out to left field and played the rest of the game.
Holliday returned to the Cardinals on Saturday after missing nine games with a tendon injury on his right middle finger. La Russa said he wouldn't start on Wednesday. ... Cardinals SS Rafael Furcal, who left Monday's game in the fifth inning with tightness in his left hamstring, was held out. La Russa said Furcal would not return for Wednesday's game, but he wasn't sure about his availability if the Cardinals play past that game. ... Houston closer Mark Melancon and his wife Mary Catherine had a girl named Brooklyn Marie on Tuesday. ... Chris Carpenter pitches for the Cardinals against Brett Myers in the regular-season finale on Wednesday. Myers has won four straight games and has a 1.24 ERA in his last five starts. Carpenter is 7-5 in his career against the Astros, but hasn't won in Houston since 2005.