NFL: Miami Dolphins at New England Patriots

Dolphins defensive back Tae Hayes breaks up a pass intended for Patriots wide receiver Phillip Dorsett during Sunday’s game at Gillette Stadium.

FOXBOROUGH, Mass. — This wasn’t supposed to happen.

The Patriots were not supposed to open their quest for a seventh Super Bowl title by playing a wild card game.

“We’ve got a game next week and we’ve got to be ready to go,” Devin McCourty said after veteran journeyman quarterback Ryan Fitzpatrick guided Miami 75 yards to a winning touchdown with 24 seconds left as the Dolphins knocked the Patriots into Wild Card Weekend for the first time since 2009 with a 27-24 upset.

As 17-point underdogs, the Dolphins (5-4 after an 0-7 start) pulled off arguably the biggest upset of the season in the NFL.

“It was a great chance for us not to play next week and we didn’t take advantage of it,” quarterback Tom Brady said.

Fitzpatrick, who at 37 is practically a kid compared to the 42-year-old Brady, hit Mike Gesicki with a 5-yard touchdown pass to answer the Pats’ go-ahead TD and drop New England to the No. 3 seed and into a home game next weekend. Kansas City, by virtue of its 31-21 win over the Chargers, slipped into the No. 2 seed.

The Patriots will host the Tennessee Titans and old friend Mike Vrabel for a wild card game next weekend. If the Pats win that game, they will visit Kansas City for a divisional round game.

The Patriots have been to nine Super Bowls but have never reached the title game when their playoff run started with a wild card game, failing on three previous tries.

On a day that featured the NFL’s top-rated and worst-rated defenses, Fitzpatrick picked the Patriots apart. And though Brady threw two touchdowns against Miami, it was his pick-six to former teammate Eric Rowe at the Patriots’ 35-yard line that helped give the Dolphins a 10-0 lead just under five minutes into the second quarter.

It was the first time Brady has had an interception returned for a touchdown since 2017.

When it was all over, the Patriots sat at 12-4, but went just 4-4 after an 8-0 start.

Brady was 16-for-29 for 221 yards, and his 13-yard swing pass and run by James White with 3:29 left gave the Patriots their only lead of the game. Brady’s two touchdown passes Sunday gave him 540 for his career, moving him ahead of Peyton Manning into second place all-time.

“We definitely had a lot of confidence,” Fitzpatrick said. “Once they got down there, I was kind of happy they took the lead rather than tie it up just so it was really all on us to go down there and score a touchdown or not.”

Brady’s other TD pass was a 38-yard score to two-way player Elandon Roberts at 4:26 of the third quarter.

Fitzpatrick was great, going 28-for-41 for 320 yards and a touchdown. He also had a 2-yard TD run as the Dolphins beat Brady in New England for the first time. Fitzpatrick became the first passer in 25 games to sting the Patriots for 300 yards.

Seven of his completions went to DeVante Parker — and six of those were with Parker covered by NFL defensive player of the year candidate Stephon Gilmore.

“It’s what we expected them to do,” Patriots coach Bill Belichick said. “They did a good job of it. Obviously, they did a good job, did a better job than we did, simple as that.”

Said Dolphins head coach and former Patriots assistant Brian Flores: “There’s a lot of memories here. I basically grew up in this building, from a professional standpoint. There’s guys on that team, on the coaching staff, but there’s people in this building from janitors to security people to media I built a lot of relationships (with).”

While Parker had 137 yards worth of catches, Isaiah Ford caught seven passes and Albert Wilson five. No Patriots receiver caught more than three.

Sony Michel ran for 74 yards, including a 2-yard TD run late in the second quarter, to finish the season with 912. Julian Edelman, battling a series of injuries, was targeted seven times and had three catches, His last catch — his 100th of the season — came on the final play of the game and led to a long series of laterals and fumbles as the Patriots tried to extend the game.

It didn’t work.