The Patriots stormed back from a 31-3 second-half deficit to tie the score, capped by Danny Woodhead's 1-yard scoring run with 6:43 left.
But LaMichael James returned the ensuing kick-off 62 yards to the New England 38-yard line, and on the next play Colin Kaepernick found Crabtree along the left sideline and he ran in for go-ahead score.
Kaepernick completed 14-of-25 passes for 216 yards, four touchdowns and one interception for the 49ers (10-3-1), who maintained their grip on first place in the NFC West and clinched a playoff spot with their fourth win in five games.
Crabtree ended with seven grabs for 107 yards and a pair of scores.
Tom Brady racked up 443 passing yards, completing 36 of his career-high 65 attempts with a TD and two interceptions for the Patriots (10-4).
Brandon Lloyd (190 yards) and Aaron Hernandez (92, touchdown) each hauled down 10 passes for New England.
Wes Welker made five catches, giving him 100 for season -- the first player in NFL history to make 100 or more grabs five times in a career.
Millions of Getty images now available for free via embed tool
Ray Liotta sues skin care company over use of likeness