CHICAGO -- Matt Prater booted the go-ahead field goal through the gusting wind right down the middle with enough room to clear the crossbar.
He also gained some revenge against a coach who cut him.
Detroit (6-4) took the lead after Tarik Cohen had tied it for Chicago (3-7) with a 15-yard touchdown run that ended with him leaping across the goal line.
Prater kicked the winner after Stafford led a 42-yard drive to the 34. The Lions escaped with their third straight win when the Bears' Connor Barth was wide right on a 46-yarder in the closing seconds.
"It was pretty difficult, just with the winds gusty, couldn't really tell what it was doing," said Prater, a two-time Pro Bowl selection. "Good thing I had (holder) Sam (Martin) kind of caddie me, said play it at the left upright. Then I think he was almost jumping on me. And I kind of lost it. I don't know, I started yelling at coach Fox maybe, but it was fun."
Fox was coaching Denver in 2014 when the Broncos cut Prater. They did that just days before he was to rejoin the team following a four-game suspension for violating the league's substance-abuse policy to start that season.
As for Barth?
He wasn't even close as he attempted to force overtime. He is now 11 of 16 on the season, all five misses from 40 and beyond.
"I think I hit the ground a little bit and just didn't make good contact," he said. "So, it was a tough one."
Stafford completed 21 of 31 passes. Marvin Jones Jr. had four receptions for 85 yards and a TD.
DJ Hayden ran back a fumbled snap for a touchdown to give Detroit seven return TDs this season, tying a team record. And the Lions beat the Bears for the eighth time in nine games.
Detroit also improved to 3-0 against the NFC North. All those wins are on the road, with one coming at division leading-Minnesota. The Lions host the Vikings on Thursday.
"I think we're a confident group no matter what time of the game it is," Stafford said. "Fourth quarter, first quarter, it doesn't matter. We go out there and just try to play as good a football as we can. I've got confidence into the fourth quarter with the guys around me."
Chicago dropped its third straight even though Jordan Howard ran for 125 yards and a touchdown. Mitchell Trubisky faded after a strong start, throwing for 179 yards and a TD. His 19-yard scramble on fourth-and-13 in the final minute put the ball on the Detroit 43.
He then hit Dontrelle Inman with a 15-yard pass, giving Barth a chance to force overtime. But the Bears once again came up short after a rough loss to Green Bay that reignited the heat on Fox.
"It's always frustrating losing," Cohen said. "It adds to that when you know you're right on the fringe of being a successful team. More than not a couple games we've lost have come right down to the wire. We know that if we do certain things right the game could come out totally different."
Bears linebacker Leonard Floyd was taken from the field on a cart early in the fourth quarter with what Fox described as a "fairly serious" knee injury he suffered trying to defend a run.
Several teammates kneeled nearby as the medical staff tended to him on the field. Cornerback Kyle Fuller was seen bleeding from his left wrist after the play, though he returned to the game.
Moments after Floyd went down, Prater kicked a 27-yard field goal to make it 24-17 with about 10 minutes left.
"I liked the fight we had in us. I think we all recognize the fact that we put ourselves in that position, but I liked the way we came out of it. Oftentimes, particularly on the road, some teams take a nosedive when they get behind and don't come back." -- Coach Jim Caldwell on the Lions rallying from 10 down to take a four-point halftime lead.
Bears: WR Josh Bellamy got shaken up blocking on a pass play in the third quarter and entered the concussion protocol. ... RG Kyle Long (finger) was back in the lineup after being limited to one special-teams play last week. ... LB Danny Trevathan (calf) and TE Dion Sims (illness) were inactive for the second straight week.
Lions: Host the Vikings on Thursday.
Bears: Visit the Philadelphia Eagles on Nov. 26.
For more NFL coverage: http://www.pro32.ap.org and http://www.twitter.com/AP-NFL
Donald: The goal is always 'to be the best'
Aaron Donald is happy to be considered for back-to-back NFL Defensive Player of the Year awards as he feels he's playing his best football of his career.
As if the pressure of playing for the Los Angeles Rams' first playoff victory in 14 years wasn't enough, Todd Gurley carries an extra imperative into the Coliseum on Saturday night.
Parkey challenge: Make a 43-yard kick, win a trip not beer
Goose Island Brewery is trying to ease Bears' fans pain by offering a road trip for a made field goal.
Vikings luck out with Kevin Stefanski returning as offensive coordinator
The Vikings removed the interim tag from his title, avoiding what could have been a complicated search for a new playcaller and ensuring continuity.
Given the postseason history involving Indianapolis and Kansas City over the years, Andrew Luck and the Colts have every reason to feel confident heading to Arrowhead Stadium on Saturday.
The Patriots need to keep an eye on Derwin James
Derwin James has his name in the conversation for Defensive Rookie Of The Year because of his versatility and ability to make big plays. The Patriots will need to game plan for the young playmaker in order to advance to the AFC Championship Game.