A game that the Ravens thought they had won about 30 minutes earlier was finally won, thanks to the right leg of Justin Tucker.

After the Cincinnati Bengals forced overtime with a 51-yard Hail Mary touchdown from quarterback Andy Dalton to wide receiver A.J. Green with no time on the clock in regulation, Tucker connected on a 46-yard field goal in overtime, giving the Ravens a much-needed 20-17 victory in front of an announced 70,922 at M&T Bank Stadium.

The victory -- the Ravens' first since Oct. 6 -- ended a three-game losing streak and pullled the Ravens (4-5) within 1 1/2 games of the first-place Bengals (6-4) in the AFC North.

Quarterback Joe Flacco threw two first-half touchdown on an otherwise tough day for the offense. The Ravens defense forced three interceptions by Dalton and sacked him five times.

However, all of that was overshadowed by the final seconds of regulation, when the Bengals completed a comeback from down 17 points to tie the game.

Trailing, 17-10, the Bengals got the ball back on their own 40-yard line with 1:28 to play and no timeouts. When Elvis Dumervil had sacked Dalton for the third time, Cincinnati had to spike the ball to set up one final throw toward the end zone. The Hail Mary was deflected by the first wave of defenders just shy of the end zone, and then it hit off James Ihedigbo’s hands. Green caught the deflection toward the back of the end zone with no defender close to him.

The Bengals won the coin toss and had the first possession of overtime. But on fourth-and-2 from the Ravens’ 33, Dalton threw a dump-off to rookie Giovani Bernard, who was pulled down by Corey Graham and Ihedigbo for a loss off 11 yards.

The Ravens took over at their own 44 and then were officially in Tucker’s range when Flacco hit tight Ed Dickson for an 8-yard first down.

The Ravens led, 17-0, at halftime and 17-3 heading into the fourth quarter. However, they got nothing going offensively in the second half, and when Dalton hit Bernard for an 18-yard touchdown, the Bengals trailed just 17-10 with 8:22 to play in the fourth quarter.

The Ravens finally got a couple of first downs as Flacco hit Jacoby Jones for 8 yards and tight end Ed Dickson for 18. A personal foul by Bengals linebacker Vontaze Burfict, who hit Flacco as he was going out of bounds, allowed the Ravens to move into Cincinnati territory.