DETROIT - The Lions are still in prime position in the NFC wild-card race -- but just barely.
Linebacker DeAndre Levy appeared to get away with grabbing Webb's facemask before the fumble.
Matthew Stafford threw for two scores in the first quarter to give Detroit one of its three-touchdown leads. But the Vikings, playing for pride, nearly rallied from a 31-14 halftime deficit.
The Lions (8-5), seeking to make the playoffs for the first time since the 1999 season, were in a precarious spot after losing five of seven.
Webb led the Vikings (2-11) to touchdowns on his first two drives after rookie Christian Ponder was benched and was a yard away from another TD.
On first-and-goal from the 1 with 9 seconds left, a replay appeared to show Levy grabbing Webb's facemask, but a flag wasn't thrown. The ball popped free at the 11 and was batted back toward midfield by Detroit's Stephen Tulloch. Webb ran it down and tried to pick it up, but the ball came loose again and Cliff Avril finally fell on it to end the game.
A penalty would've given the Vikings one more shot to score with no time on the clock.
Avril, who jumped offside on the previous play to stop the clock and put Minnesota a yard closer to the end zone, was credited with the sack, forced fumble and recovery on the wild play that finished at the Minnesota 43.
The Lions almost blew a big lead as the Vikings did in Week 3 against them.
Detroit won at Minnesota 26-23 in overtime after trailing 20-0 at halftime. This time, Detroit led by 17 after two quarters despite making just five first downs and going 0-for-5 on third down.
The Vikings committed four turnovers, including a play when running back Lorenzo Booker fumbled without being touched.
Ponder was benched after his fourth turnover. He fumbled on his first play of the game, getting stripped by Avril, and Tulloch recovered for a score. Ponder threw an interception on his fourth snap to set up Stafford's first TD pass. Alphonso Smith made his second interception early in the second quarter and returned it for a TD to give Detroit a 28-7 lead.
Ponder's day was done after he threw a third interception on the opening drive of the third quarter, faking a handoff to no one, rolling right and throwing over the middle to cornerback Eric Wright.
Webb replaced Ponder and promptly scored on a 65-yard run to pull Minnesota within 31-21.
The Lions stalled at the Vikings 2 on the ensuing drive, and instead of going for it on fourth-and-1, they settled for Jason Hanson's field goal and a 34-21 lead.
That almost wasn't big enough.
Webb made plays with his legs and arm on his second drive, capped by a 2-yard toss to Toby Gerhart that pulled the Vikings within six midway through the fourth quarter.
Stafford was 20 of 29 for 227 yards.
Ponder was 11 of 21 for 115 yards with two touchdowns. Webb ran for 109 yards and was 12 of 23 for another 84.
Ponder and Webb didn't have the luxury of handing off to Adrian Peterson, who missed his third straight game with a sprained left ankle. Percy Harvin had a career-high 10 receptions for 109 yards and a score.
Detroit was missing starting running back Kevin Smith (right ankle), two starters in the secondary -- Louis Delmas (right knee) and cornerback Chris Houston (left knee) -- and defensive tackle Ndamukong Suh, who served the second of his two-game suspension for stomping on a Green Bay Packer on Thanksgiving.