You had the feeling if the Lions could only get out of their own way, they would have a good chance to beat the Cowboys Sunday.

After all, for three quarters the defense had held Tony Romo and the Dallas offense in relative check. Calvin Johnson was in full Megatron mode, achieving an NFL-record tying fifth career 200-yard receiving day (329 yards). And the Cowboys were playing without four starters -- DeMarcus Ware, DeMarco Murray, Miles Austin and J.J. Wilcox.

It took them until the final seconds, but they did it. Trailing 30-24 with 62 seconds left and no timeouts, quarterback Matthew Stafford drove the Lions 80 yards, running in the game-winner from the 1.

He hit Calvin Johnson for 17 yards, Kris Durham for 40 yards and then Johnson again, splitting two defenders, for 22 yards to put it at the 1.

With 12 seconds left, Stafford leaped and stuck the ball over the goal line. When David Akers booted the point after, the Lions celebrated a thrilling, improbable 31-30 win.

Johnson caught 14 passes for 329 yards -- second most in NFL history. Flipper Anderson had 336 for the Rams in a game against the Saints in 1989.

Stafford finished 33 of 48 for 488 yards.

Until their final drive, the Lions kept tripping themselves up. Four turnovers, all of them in Dallas territory, and two huge break downs on passing plays by Romo had the Lions in deep trouble.

The first dagger came with 11:32 left in the game. The Lions, down 13-7, had just squandered a golden scoring chance inside the Cowboys 3 and settled for a 20-yard field goal by David Akers.

With the sellout crowd still groaning from that, Romo hit receiver Terrence Williams on a slant pass. Williams initially beat rookie Darius Slay and then broke a tackle attempt by safety Glover Quin to go 60 yards for a touchdown.

The Cowboys were up 20-10. But that one didn't kill the Lions.

The offense continued to churn up yardage. Stafford drove the team 80 yards with Joique Bell capping the drive with a 1-yard touchdown run.

With 7:38 left, the deficit was three -- 20-17.

The Lions followed that up with a breakdown on kickoff coverage. Dwayne Harris took the kick eight yards deep in the end zone and ran it straight up the middle for 56 yards.

Two plays later, Romo hit Dez Bryant for a 50-yard touchdown to restore the 10-point lead. Bryant beat Rashean Mathis and Louis Delmas along the sideline.