FOXBOROUGH, Mass.—It was a wild one, a game completely controlled by the San Francisco defense for about 35 minutes as the 49ers built a 28-point lead. But the vaunted Patriots offense found its stride in the second half and pulled back to a tie—before a long San Francisco kick return by LaMichael James and Colin Kaepernick’s fourth touchdown pass of the night finally gave the 49ers the cushion they needed.

In the end, they came away with an impressive 41-34 road win, handing the Patriots their first December home loss in a decade.

Hard to say what can be learned from a head-scratcher like this, but here goes:

1. The playoff picture sure looks clearer. For the 49ers, this win was a necessity in order to stay just ahead of Green Bay as they fight for a first-round bye. San Francisco is now 10-3-1, a half-game ahead of the Packers, who beat Chicago on Sunday. The 49ers are still behind Atlanta in the NFC but control their own fate in their division as they head into another big game next weekend in Seattle, followed by the season-ender against Arizona.

The Patriots, meanwhile, had about as bad a day as possible, with Denver beating Baltimore to go to 11-3 while New England fell to 10-4. With Houston (12-2) still leading in the AFC, the Broncos now have the inside track on a first-round bye and the Patriots probably will have to be ready to play on wild-card weekend.

2. Brady in the no-huddle is still the Patriots’ best bet. Over the course of this season, New England has tried to diversify its attack, working in a lot more of the running game behind Stevan Ridley and fellow second-year man Shane Vereen. But the running game abandoned the Patriots on this night, and the Ridley-Vereen combo each did something unforgivable in the eyes of coach Bill Belichick—they fumbled.

Ridley developed a fumbling problem late last year, and Belichick responded by giving him just four carries in the postseason.

At this point, the only back Belichick trusts is Danny Woodhead. If that remains the case, then it’s back to the hurry-up, spread-and-fling offense that the Patriots have employed over the past couple of years.

That’s not exactly a terrible idea. They went to the Super Bowl without much of a ground game last year, and it was that approach that allowed them to break out of their offensive funk, erasing the 31-3 lead that the Niners held with 10:21 to play in the third quarter.

3. Andy Lee was the hidden star for San Francisco. Punters, of course, mostly toil in anonymity. But heading into the game, Belichick had warned that Lee is the kind of punter who can alter field position. Lee had two crucial fourth-quarter bombs—both of which were aided by Patriots’ holding penalties—that helped to stave off the Pats’ second-half onslaught.

The first came with 10:07 to go in the fourth quarter and New England having cut the lead to 31-24. Lee unleashed a 64-yard kick that Wes Welker caught on the 15-yard line, and the Patriots were bumped back to the 7-yard line after the holding penalty. The second came with just 3:09 to play and the Patriots trailing, 38-31.

Lee hung up another long kick, from his own 35-yard line down to the New England 6-yard line. After the penalty, the Patriots opened their last-ditch drive starting from their 3, and that just proved to be too much—Brady could not get them so much as a first down from that spot, and the game was all but over.