MINNEAPOLIS — The end was as good as the Vikings could have imagined: Brett Favre zipped a pass to a little-used reserve wide receiver in the back of the end zone in the final seconds for a classic Favre finish.

MINNEAPOLIS — The end was as good as the Vikings could have imagined: Brett Favre zipped a pass to a little-used reserve wide receiver in the back of the end zone in the final seconds for a classic Favre finish.

Greg Lewis leaped for a 32-yard touchdown catch with 2 seconds left while a flattened Favre watched from his stomach, and the Vikings stunned the San Francisco 49ers 27-24 on Sunday to stay unbeaten.

In his first real home game with his new team, Favre overcame a bunch of bad throws and a few more hard hits to his almost-40-year-old body and found that winning touch again.

"It's hard to even recall all of 'em. This one was pretty special," said Favre, who now has 43 comebacks from fourth-quarter deficits or ties on his career record.

An official review confirmed Lewis's feet were inbounds, sending the sellout crowd into a frenzy.

"I've had some hard losses. This is just another one for the list," 49ers cornerback Nate Clements said. "We just have to keep chopping away."

The first five series of the second half: Three punts, Favre's first interception, and a turnover on downs. The Vikings (3-0), who gained only 85 yards on Adrian Peterson's 19 carries, still had three timeouts left and were able to force a punt. They got the ball back at their 20 with 89 seconds remaining.

The last play began with 12 seconds left, and Favre stepped forward in the pocket and slid to the right by design to buy time for his receivers to move in position. Instead of throwing a ball up for grabs, he figured he could get close enough to the line of scrimmage to fire a line drive that would be tougher to defend.

Lewis watched the quarterback's eyes, and broke the other way — Favre said he didn't even know who was running across the end zone — to find room near the right corner.

He caught his first pass from Favre, who completed six throws on that drive, and looked forward to the next one.

Favre finished 24 for 47 for 301 yards and two touchdowns, the most passes he's thrown in a game since Nov. 11, 2007, when he beat the Vikings while with Green Bay by going 33 for 46 for 351 yards and three touchdowns. The Packers, by the way, are up next.

Their defense is surely eager to put some pressure on an old teammate. Favre took plenty of blows from the 49ers (2-1) and listed aches to his right foot, left knee, both shoulders and neck when asked for a report on his health.

Until the end, Favre was being outplayed by Shaun Hill, a former Minnesota third-stringer who threw two touchdown passes to tight end Vernon Davis. The second was a 20-yard toss over three defenders that gave the Niners a 24-20 lead midway through the fourth quarter.

They sacked Favre twice and applied plenty of pressure. The Hill-to-Davis combination led to seven completions and 96 yards. And they survived the early exit of star running back Frank Gore to an ankle injury by rallying on the road to the verge of victory.

Naturally, the players were devastated, but coach Mike Singletary wouldn't have it.

"You have nothing to be looking at the floor for!" Singletary yelled, not worried reporters were in the adjacent room. "You didn't steal anything! You didn't do anything wrong! OK? We're going to get better! We're going to get there! We will see them again in the playoffs, all right? You hold your head up!"