Updated

The Boston Red Sox completed their September collapse in horrific and historic fashion, falling out of the playoff chase by allowing two ninth-inning runs in a 4-3 loss to the Baltimore Orioles on Wednesday night.

The Red Sox held a nine-game lead in the AL wild-card race after Sept. 3, but a 7-19 swoon left them tied with Tampa Bay entering the final day of the regular season.

Only minutes after this game ended, the Rays completed their comeback from a 7-0 deficit with an 8-7 win over the New York Yankees in 12 innings.

Even if Tampa Bay lost, the Red Sox faced the prospect of a quick turnaround following a long night at Camden Yards that included a rain delay of 1 hour, 26 minutes in the middle of the seventh inning.

When the rain came, Tampa Bay trailed 7-0. By the time play resumed, the Rays and Yankees were tied at 7 heading into the 10th inning.

The Orioles won the game in the ninth against Boston closer Jonathan Papelbon (4-1), who struck out the first two batters before giving up a double to Chris Davis.

Nolan Reimold followed with a double to score pinch-runner Kyle Hudson, and Robert Andino completed the comeback with a single to left that Carl Crawford couldn’t glove.

Boston became the first team to miss the postseason after leading by as many as nine games for a playoff spot entering September, according to the Elias Sports Bureau.

Jim Johnson (6-5) worked the ninth for Baltimore.

On the National League side in Houston, Chris Carpenter and the St. Louis Cardinals completed one of baseball’s greatest comebacks, clinching the NL wild card Wednesday night with an 8-0 win over Houston and a later loss by Atlanta.

The Cardinals got their playoff spot when the Braves fell to Philadelphia 4-3 in 13 innings.

St. Louis trailed Atlanta by 101/2 games on Aug. 25. The Cardinals won 23 of their last 31 games.

The Cardinals will open the postseason on Saturday at NL East champion Philadelphia. In the other NL playoff matchup, Arizona visits Milwaukee.

Carpenter (11-9) struck out 11 and allowed two hits in his 15th career complete-game shutout as St. Louis kept up its improbable September charge.

“We had nothing to lose. We were already out of it,” Carpenter said. “People were telling us we were done. We decided to go out and play and not embarrass ourselves and do what we can. We played ourselves back into it.”

The Cardinals poured onto the field after Carpenter fielded J.D. Martinez’s weak grounder for the final out. The celebration was brief and muted, as the team raced into the clubhouse to watch the end of the game in Atlanta.

“It was exciting, there’s no doubt about it,” Carpenter said. “The way these guys have played the past month and a half has been amazing, every single night grinding, playing their butts off, not giving up.”