FOXBORO, Mass. — The New England Patriots were singing a quarterback’s praises after Sunday’s win over the Buffalo Bills, and it wasn’t Tom Brady.

It was Nick Foles, the man who, less than a year ago, crushed New England’s hopes of a sixth Super Bowl title.

Foles, who replaced Carson Wentz as Philadelphia’s starting quarterback last week, led the Eagles on a last-minute, game-winning drive to cap a 32-30 victory over the Houston Texans.

That game, which went final roughly 15 minutes after the Patriots finished off their 24-12 triumph over the Bills at Gillette Stadium, had major playoff implications. Had the Texans won, they would have maintained their status as the No. 2 seed in the AFC and had a chance to clinch a first-round bye with a win or Patriots loss next week.

Foles’ heroics, though, allowed New England to vault into second place in the conference standings. The Patriots now can secure free passage to the divisional round with a victory over the 4-11 New York Jets in next Sunday’s regular-season finale.

Asked about the frantic finish in Philly, which culminated in a 35-yard game-winning field goal by Jake Elliott as time expired, Duron Harmon smiled.

“Shout-out Nick Foles,” the Patriots safety said.

Many Patriots players tuned into Eagles-Texans as they pulled on their freshly unboxed AFC East championship hats and T-shirts. Harmon followed along on his phone.

“I had the phone going overtime — just refreshing, refreshing, refreshing,” he said. “It was third-and-10 at one point, and I see (Foles) throw the 30-yard bomb to Alshon (Jeffery). Literally, I was just refreshing, refreshing like, ‘All right, C’mon, Nick. Give me some of that magic that we saw last year.’ ”

Foles obliged, converting two third-and-10s and surviving a bone-crushing hit from Jadeveon Clowney as he marched the Eagles down the field for Elliott’s winning kick. The Texans had scored touchdowns on each of their previous two drives to go ahead 30-29 with 2:04 remaining.

Foles finished with 471 yards and four touchdown passes in the win. The Eagles are 2-0 since he took over for the injured Wentz, knocking off two playoff teams in the Los Angeles Rams and Texans.

“Nick Foles plays his best ball in December,” Harmon said, recalling Foles unlikely road from backup QB to Super Bowl LII MVP last season. “He’s a competitor. We saw that in the Super Bowl. We saw that leading up to the Super Bowl when he had to take over for the Eagles at the quarterback position last year. We know what type of player he is, and he’s doing it all over again.

“So I thank him for leading that offense today, especially on that two-minute drive. That takes guts, and he did that against a really good team.”

A highlight of the QB’s 80-yard touchdown pass to Nelson Agholor that ran on the Gillette Stadium video board during the game elicited a loud cheer from the Patriots faithful.

Wide receiver Julian Edelman, who missed the Patriots’ 41-33 loss to the Eagles last February with an injury, appreciated the help, as well.

“Fly Eagles Fly,” Edelman said after Sunday’s game.

The Patriots also thanked Foles on their official Twitter account.

Sunday represented a sizable momentum shift for the Patriots, who had been trending downward after back-to-back road losses to the Miami Dolphins and Pittsburgh Steelers. They’ll likely be favored by double digits over the Jets as they look to lock down a first-round bye for the ninth consecutive season.

“We put a lot of work into this, and now we’ve got to go out and keep on improving,” Edelman said, “because there’s a lot of meat on that bone left.”

Thumbnail photo via Eric Hartline/USA TODAY Sports Images