The Ravens were on the brink of a historic upset.

Instead, they had to deal with one of the most heartbreaking defeats in their history.

Hurting themselves in the fourth quarter with questionable decision-making, the Ravens fell short in a painful 27-24 loss to the unbeaten New England Patriots last night at a blustery M&T Bank Stadium.

Patriots quarterback Tom Brady capitalized on the Ravens' mistakes, throwing an 8-yard touchdown to Jabar Gaffney with 44 seconds remaining.

The 13-play, 73-yard drive was Brady's 21st game-winning one in the fourth quarter or overtime, the most in NFL history.

The Ravens' last gasp ended on the final play at the Patriots' 3-yard line, where Mark Clayton was tackled after catching a Hail Mary pass from Kyle Boller.

The Ravens helped the Patriots with some troubling moves. They failed to run on third-and-two late in the fourth quarter, they called a timeout that nullified a fourth-down play - on which they had stopped the Patriots - , and linebacker Bart Scott was called for two unsportsmanlike penalties in the final minute.

"We hung in there the whole game," Ravens quarterback Kyle Boller said. "I'm so proud of our guys. We just came up a little short in the end."

The Patriots took another step in their march to a perfect season, improving to 12-0.

The Ravens (4-8), who entered the game as 19-point underdogs, lost for a franchise-worst sixth straight game despite putting together their best performance of the season.

Leading 24-20 with 1:48 left in the game, the Ravens appeared to have made a game-winning stop, stuffing Brady on a fourth-down sneak. But the Ravens had called timeout just before the snap, which gave New England another chance to continue the drive.

"We didn't feel like we were in the right configuration," coach Brian Billick said. "We kind of knew what they were going to do and felt like we needed a better call, I guess."

Asked who called the timeout, a terse Billick responded, "We called the timeout. If he had gotten the first, you'd be screaming why didn't you call a timeout. Let's make sure we don't have revisionist history here, OK?"

Television replays showed defensive coordinator Rex Ryan signaling for a timeout.

Immediately after Brady's game-winning touchdown, Scott put a dent in the Ravens' comeback chances. After being penalized for unsportsmanlike conduct, he picked up the flag and threw it into the stands, drawing another 15-yard penalty.

Cornerback Samari Rolle said an official repeatedly called him "boy," which set off Scott at the end of the game. Scott declined to comment before leaving the locker room.

"You got to be smarter than that," Billick said. "You can't be a dumb football player."

After the penalties, the Patriots kicked off from the Ravens' 35-yard line for a touchback, eliminating any chance for a Ravens' runback.

On the game's final play, Boller heaved a 52-yard pass in the air that was caught by a leaping Clayton, who was stopped at the Patriots' 3-yard line by a mob of Patriots.