BALTIMORE (AP) The crowd was yelling as the clock was winding down. The Baltimore Ravens and their fans were poised for a New Year's Eve celebration, long before the clock struck midnight.

And then, an instant later, silence.

There would be no football in January for the Ravens, who were ousted from the playoff hunt in stunning fashion Sunday when Andy Dalton threw a 49-yard touchdown pass to Tyler Boyd with 44 seconds left to give the Cincinnati Bengals a 31-27 victory.

Needing a win to advance to the postseason, Baltimore (9-7) rallied from a 14-point deficit to take its first lead with 8:48 left. But Dalton put together a magnificent 90-yard drive in the closing minutes before hitting Boyd over the middle on a fourth-and-12 play.

''To battle our way back the way we did, and then not to be able to finish and win the game is about as tough as it can be,'' coach John Harbaugh said.

Boyd avoided a tackle by Maurice Canady and raced to the end zone to give Cincinnati (7-9) the victory in what might have been its final game under coach Marvin Lewis.

Baltimore entered knowing it could have also gotten into the postseason if either Tennessee or Buffalo tied or lost. Both those teams won, leaving the Ravens with no margin for error on a frigid and windy day.

''Nobody's happy,'' safety Eric Weddle said. ''We didn't make the plays. We weren't good enough.''

After getting off to a horrid start, the Ravens appeared in position to end their two-year hiatus from the postseason. Plenty of players stepped up in their time of need: Chris Moore had a pivotal kickoff return, Alex Collins delivered a huge fourth-down touchdown run and quarterback Joe Flacco bounced back from a horrible 4-for-18 start.

Flacco's 6-yard touchdown pass to Mike Wallace made it 27-24, but all of that was rendered meaningless after Dalton put an appropriate finish on a game filled with huge plays.

Dalton also threw a pair of touchdown passes to Tyler Kroft.

Whether it was Lewis' last game on the sideline after a 15-year run with the Bengals will likely be determined on Monday. If it was the finale, it was a heck of a finish to a tenure in which Lewis went 125-112-3 in the regular season and 0-7 in the playoffs.

Asked if he would like a shot at Year 16, Lewis replied, ''Yes, I want to coach this team.''

But he added: ''It's more complicated than that.''

He is expected to meet with owner Mike Brown on Monday.

The Ravens were down 17-3 late in the first half when Moore rambled 87 yards with a kickoff before being stopped near the left sideline with 8 seconds left. He finished what he started on the next play, catching a 6-yard touchdown pass.

Thus, Baltimore trailed by only 17-10 at the break despite a 268-61 deficit in yardage and 16-2 disparity in first downs.

The Ravens took that momentum into the third quarter, moving deftly downfield before Moore juggled a pass that ended up in the hands of Cincinnati's Darqueze Dennard, who sprinted down the left sideline 89 yards for a touchdown .

Trailing again by two TDs, Baltimore faced a fourth-and-3 from the Cincinnati 17. Collins took a pitchout designed to go around left end, reversed his field and ran around a block by Flacco to get into the right corner of the end zone.

That set the stage for a tense fourth quarter in a game Cincinnati dominated at the outset.

The Bengals moved 78 yards on eight plays following the opening kickoff and took a 7-0 lead on a 1-yard touchdown pass from Dalton to Kroft. That represented more points than Cincinnati scored in the first game between the teams, a 20-0 Baltimore victory in the season opener.

The Ravens' first five possessions produced several dropped passes, one first down and five punts.

CHILLIN' TO THE MAXX

Ravens tight end Maxx Williams went through preliminary warmups without a shirt, even though the temperature was 19 degrees. He did, however, wear a knit hat and sweat pants.

INJURY UPDATE

Bengals: LB Jordan Evans (head, shoulder) left in the third quarter. ... WR Josh Malone (ankle) did not play in the second half. ... S Shawn Williams (back) left in the third quarter.

Ravens: Moore sustained a concussion in the third quarter and did not return. ... WR Jeremy Maclin (knee) was inactive for a second straight week. ... Ravens DB Anthony Levine (foot) left in the second quarter.

---

For more AP NFL coverage: http://pro32.ap.org and http://twitter.com/AP-NFL

Copyright 2017 by AP. Any commercial use or distribution without the express written consent of AP is strictly prohibited.