DAVIE, Fla. (AP) -- One play from defeat each of the past two weeks, the Miami Dolphins are now two wins from their first playoff berth since 2008.
The Dolphins (8-6) control their own destiny and will earn the AFC's sixth and final wild-card spot if they win Sunday at Buffalo and beat the New York Jets at home in the regular-season finale.
Miami managed a second consecutive narrow escape Sunday, intercepting Tom Brady's pass in the end zone with 2 seconds left to beat AFC East leader New England 24-20. The previous week, the Dolphins won at Pittsburgh 34-28 when the Steelers' Antonio Brown barely stepped out of bounds before reaching the end zone on a wild final play.
''I don't care if it's the last play of the game, or we won by 40 points,'' Miami defensive end Cameron Wake said. ''Either way, at the end of the day it's a W in the column.''
The Dolphins might seem improbable playoff contenders. They've been outgained this year by 378 yards and rank in the lower half of the NFL in many offensive and categories. A bullying scandal had the team in a tailspin only a few weeks ago, when tackle Jonathan Martin abruptly departed and guard Richie Incognito was suspended.
But the Dolphins are 5-2 since Martin left, a surge that has saved their season - and might extend it.
''To actually do the job after what they've gone through, this is the very essence what we call that football family, when you're going through tough situations to come out better than you actually (were) when you went in,'' said former Pro Bowl receiver Michael Irvin, an analyst on NFL Network.
Coincidentally, the last-second hero in the latest victory was Michael Thomas, who was Martin's teammate at Stanford and remains a good friend. Making his NFL debut after being signed last week off the 49ers' practice squad, Thomas broke up one pass in the end zone in the final seconds and then intercepted Brady on fourth down.
That sealed the Dolphins' third win in a row. They'll be favored in their final two, although they lost at home to lowly Buffalo in October.
With Sunday's victory, the Dolphins ended a streak of four consecutive losing seasons, the franchise's longest since the 1960s. They also ended a streak of seven losses in a row to nemesis New England.
''This feels like finally getting over the hump,'' tackle Bryant McKinnie said. ''This is coming together at a good time, because you know December is when you want to be playing your best ball.''
McKinnie does know - last season he helped the Baltimore Ravens win the Super Bowl. The Dolphins aren't yet talking Super Bowl, since their most recent playoff victory came in 2000.
But the bandwagon's growing for the attendance-challenged franchise, and the latest seesaw victory had fans in a frenzy and players showing some swagger.
''As long as we don't beat ourselves, we can beat anybody,'' receiver Mike Wallace said. ''It was a great win for the organization and for the fans, but we have bigger things in mind.''
To finish strong, the Dolphins must overcome a recent spate of injuries on defense. Tackle Paul Soliai left Sunday's game in the first half with an ankle injury, and injuries in the secondary forced Miami to rely on rookie Will Davis and newcomer Thomas during the Patriots' final drive.
When Thomas made his clinching interception, he was swarmed by teammates who didn't even know his name, and the celebration reduced the safety to tears.
''I'm going to remember this one for the rest of my life,'' Thomas said. ''To see the whole team embrace me like this, the rest of the organization, I mean even the trainers and stuff like that, that's what you want. That's why you play the game, for that camaraderie.''
Following the game, button-down coach Joe Philbin had said he would celebrate with a rare dip in his swimming pool at home. When asked Monday if he followed through on that plan, Philbin smiled.
''I walked into the pool. I wouldn't say I jumped into the pool,'' he said. ''There was no cannonball.''
He might be saving something for the playoffs.
AP NFL website: www.pro32.ap.org and http://twitter.com/AP-NFL
Follow Steven Wine on Twitter: http://twitter.com/Steve-Wine