The Cleveland Browns called a timeout and gave the rookie a chance to get back in the game.
"That was wild," Stafford said with ice strapped around his shoulder.
The No. 1 pick in the NFL draft became the first rookie to throw five TDs in a game since Ray Buivid for the Bears in 1937, according to STATS LLC.
Detroit was given the untimed play because safety Hank Poteat was called for pass interference in the end zone when Stafford heaved a desperation attempt.
"Once the quarterback rotated out of the pocket and they were in the end zone, you try to force the receiver out of bounds," Poteat said. "That's what I tried to do."
Stafford was hit after his throw to the end zone and replaced by Daunte Culpepper. But he was able to return because the Browns stopped the game with their timeout.
Cleveland coach Eric Mangini said he was trying to get his team ready for the play.
"It was more a function of wanting to make sure we had the right personnel and we wanted to take a look at what they were going to do," Mangini said. "We had the timeout so at that point I thought it was a good idea to use it, look at it, and get the guys in spots we thought they needed to be in."
Detroit coach Jim Schwartz said of Stafford: "He just said, 'I'm ready.' He could walk.
"There was no one who was going to stop him from going back on the field. He had come way too far in that game to not finish it."
Schwartz said X-rays showed Stafford's collarbone wasn't broken, adding more tests are needed.
"Matt's best play of the day might have been eluding four team doctors to get back on the field," Schwartz joked.
Stafford threw three of his TDs in the first half to rally Detroit from a 24-3 deficit.
He was 26 of 43 for 422 yards, the most by a Lion in a win. He threw two interceptions, the second of which looked like it might doom Detroit. Stafford tried to throw long to Calvin Johnson, who was triple-covered, and Brodney Pool picked it off in the end zone with 3:49 left.
The Lions (2-8) snapped a six-game losing streak and avoided being the NFL's first team to endure a 2-32 stretch.
Stafford started the winning drive with 1:46 remaining and no timeouts. He got a huge assist by the penalty that went against the Browns (1-9).
"I'm just so upset that my team fought so hard late in the game to put us in a situation to win and it came down to the penalty that I caused," Poteat said.
Brady Quinn threw four TDs -- surpassing his previous career total -- and connected with Michael Gaines with 5:44 left to put the Browns ahead after helping them score a franchise-record 24 points in the first quarter.
The former Notre Dame star could only hope what he did was enough.
"I was praying and hoping that our defense could get a stop for us," he said.
The Lions and Browns have been the NFL's worst teams since 1999, but they combined to play an entertaining game.
When it was over, Cleveland players were sprawled all over the field as the Lions celebrated a rare victory. Former Detroit defensive tackle Shaun Rogers went down on a knee for several moments to contemplate his latest loss after futilely trying to block the extra point.
"We had plenty opportunities and at the end we just couldn't close it out," Cleveland coach Eric Mangini said. "I'm disappointed for them and I'm sick about the outcome."
It's not of much consolation, but Cleveland showed a pulse on offense after going three games without a TD and surpassing its season high in points before the first quarter ended.
Quinn, who started the game with three TD passes in three seasons, was 21 of 33 for 304 yards and did not throw an interception.
Mohamed Massaquoi caught five passes for 115 yards and a score for the Browns, who have lost five straight.
Cleveland couldn't pick up enough first downs to run out the clock and gave Detroit another chance with a costly punt after Quinn missed Massaquoi on a third-and-5 from his 42.
"They brought pressure more than we could handle," he said. "I tried to get out quick to Mohamed and just didn't convert."
For a change, the Lions took advantage.
Stafford threw short passes, including questionable ones in the middle of the field, but scrambled on what would've been the final play before the deep pass that resulted in the penalty that kept the game alive.
"I thought the game was over -- we all did," Pettigrew said.
Johnson had seven receptions for 161 yards and a score.
Kevin Smith had 104 yards receiving and a score for the Lions, who all were raving about Stafford's gutsy final play.
"I almost wanted to cry seeing how tough Matt was at the end," Smith said. "No one knew what his injury was, or how bad he was hurt, but he still came back out there and made a play. No one would have complained if he had let Daunte take that play, but he wanted to be out there for his teammates."
Browns owner Randy Lerner declined comment via e-mail about his search for a person to run his team after former NFL general manager Charlie Casserly said on CBS he has not spoken to the Browns, adding the team has contacted Mike Holmgren. ... There was a moment of silence before the game for Stefanie Spielman, the wife of former Lions star Chris Spielman, who died Thursday. ... Josh Cribbs played less than a week after he was strapped to a backboard and wheeled into an ambulance.