MIAMI GARDENS, Fla. (AP) -- Joe Philbin cracked a joke, which was just the latest surprise from the Miami Dolphins.
Their season seemed derailed in November by a bullying scandal, but Miami moved into the lead for the AFC's final wild-card berth Sunday by beating AFC East leader New England 24-20.
Dolphins newcomer Michael Wilson intercepted Tom Brady in the end zone on fourth down with 2 seconds left to seal the victory, the third in a row for Miami (8-6). The seesaw win left even stoic second-year coach Philbin in a mood to celebrate.
''I might jump in my pool,'' he said. ''I've been in it once since I've been here.''
The Dolphins snapped a streak of seven consecutive losses to the Patriots (10-4), who missed a chance to clinch their fifth consecutive AFC East title. Here are five things we learned from the game:
STYMIED COMEBACK: The Patriots had mounted second-half rallies to win their past three games, and were on the verge of doing it again when Brady led them from their own 20 with 1:15 remaining to the Miami 14.
''I think it took about two years off my life,'' said Miami receiver Mike Wallace, who squirmed as he watched Brady from the sideline. ''With that guy over there, you have to be nervous.''
New England was out of timeouts when Brady threw for the end zone four times in a row. The first three passes went incomplete, including one intended for Danny Amendola that Thomas broke up on first down. Then Thomas stepped in front of Austin Collie to make his interception.
Brady threw for 364 yards but was frustrated by a succession of squandered scoring chances. He answered only two questions at his postgame news conference and cut the session short after saying, ''We had plenty of chances all day. We made some good plays, and we made some (lousy) plays. Thank you.''
THE HERO WAS WHO?: Thomas, a reserve safety, made his NFL debut after being signed last week off the San Francisco 49ers' practice squad. He celebrated his interception by flopping to his back and was swarmed by his new teammates.
''I didn't know what his first name was,'' defensive tackle Jared Odrick said. ''That's being thrown in the fire and reacting. That's a pure athlete.''
Thomas was part of an injury-depleted secondary that also included backups at both cornerback spots on the final drive.
TERRIFIC TANNEHILL: Miami quarterback Ryan Tannehill shook off four sacks to throw for 312 yards and three scores with no turnovers. His passer rating was a season-high 120.6, compared with Brady's 85.7.
Tannehill has led Miami to a 5-2 record since tackle Jonathan Martin left the team in a bullying scandal that drew national notoriety.
''We've grown a lot,'' Tannehill said. ''Each of us has gotten stronger through the adversity we've faced off the field and on the field.''
WINNING DRIVE: New England took a 20-17 lead when Justin Edelman scored on a 24-yard reception with four minutes left, but the Dolphins caught a break when the ensuing kickoff by Stephen Gostkowski went out of bounds, allowing them to start at their 40.
Charles Clay kept Miami's chances alive when he turned a short pass into a 6-yard gain on fourth-and-5 at midfield, and five plays later Marcus Thigpen put the Dolphins ahead to stay with a 14-yard touchdown reception.
''They were in some tight situations, especially late in the game,'' New England cornerback Kyle Arrington said. ''They just wanted it more.''
WHAT'S NEXT: The victory gave Miami a half-game lead over Baltimore in the race for the sixth and final AFC playoff berth. The Ravens play at Detroit on Monday night, then play host to New England on Sunday.
The Dolphins will end their streak of four consecutive losing seasons. They conclude the regular season with games at Buffalo and at home against the New York Jets.
''We have a good thing going right now,'' Wallace said. ''We have to keep going. People were ready to bury us a few weeks ago and throw us under the dirt.''
AP NFL website: www.pro32.ap.org and https://twitter.com/AP-NFL
Follow Steven Wine on Twitter: https://twitter.com/Steve-Wine