The Lions' quarterback connected with Brandon Pettigrew to tie the score on a 1-yard play as time expired, capping an 88-yard drive in the final 1:46. Jason Hanson followed with the game-winning conversion.
Stafford, who completed 26-of-43 passes for 422 yards, became the first rookie quarterback in NFL history to pass for five touchdowns in a game. His other scoring strikes were for 26 yards to Aaron Brown, 25 yards to Kevin Smith, 75 yards to Calvin Johnson and 1 yard to Will Heller.
Johnson caught seven passes for 161 yards and Smith had four for 104 yards, helping the Lions end a six-game losing streak.
Brady Quinn connected on 21-of-33 passes for 304 yards and four touchdowns for Cleveland.
The Lions are 2-8 and the Browns 1-9.