The Vikings (3-0) marched 87 yards in 1:27 to set up the winning score.
Lewis grabbed the pass in the back of the end zone, just keeping his feet in bounds. An official review was needed to uphold the TD.
Favre completed 24-of-46 passes for 301 yards and two touchdowns.
Percy Harvin ran a kickoff back 101 yards for a touchdown and Ryan Longell booted field goals of 40 and 52 yards for the Vikings.
San Francisco quarterback Shaun Hill was 15-of-25 for 195 yards and two touchdown passes to Vernon Davis, one on a 5-yard play and the other for 20 yards.
Nate Clements returned a blocked field goal 59 yards for another 49ers touchdown.