The Buffalo Bills and Miami Dolphins were tied at 27 points each late in the fourth quarter as Bills kicker Tyler Bass missed an extra point early in the game.
But Bass made up for it with another career-long field goal from 61 yards out with five seconds left, giving Buffalo a 30-27 victory over their AFC East rival.
Tua Tagovailoa and the Dolphins offense put pressure on their team after left-hander Josh Allen found Jaylen Waddle in the end zone and scored a touchdown on an 11-play, 81-yard drive.
CLICK HERE FOR MORE SPORTS COVERAGE ON FOXNEWS.COM
Buffalo Bills quarterback Josh Allen throws a pass during a game against the Miami Dolphins at Highmark Stadium. (Mark Konezny-Imagn Images)
Jason Saunders' extra point tied the game with just over 90 seconds left on Allen's clock. The game looked like it would go to overtime when Allen was unable to connect on a deep ball to Keon Coleman on third-and-9.
However, Dolphins safety Jordan Poyer (former Buffalo captain) was assessed a critical penalty for unnecessary roughness, giving the Bills 15 extra yards with less than a minute left. Gave a first down.
However, Bass was unable to reach the field goal line with a career-high 58 yards. It was a huge gain and should have been an easier field goal as Allen couldn't find Dalton Kincaid on the field.
Dolphins' Jonnu Smith says hurt in Buffalo ahead of game against Bills: 'Worst place'
But when Bass stepped in for the kick, he wasn't thinking about his mistake on the previous 33-yard extra point. Instead, he gained a solid 61 yards and celebrated accordingly with five seconds left.
The Dolphins attempted a desperate lateral play, but Waddle was tackled by Greg Rosseau, clinching the victory for the Bills.

Miami Dolphins running back Devon Ashen passes Buffalo Bills defensive tackle Austin Johnson at Highmark Stadium. (Mark Konezny-Imagn Images)
Buffalo fell behind in this game despite being a team averaging 38 points per game at home before Sunday's kickoff. They were trailing 10-6 at halftime and could not improve their momentum until the second half.
That's when Allen started to get better, finding Mack Hollins for the first touchdown pass of the game. Rookie running back Ray Davis then completed a 63-yard catch-and-run, boosting Buffalo's offense.
Finally, Allen's third touchdown pass of the game was a small flip to Quintin Morris from two yards out. Allen completed 25 of 39 for 235 yards, three touchdowns and one interception.
Tagovailoa, on the other hand, was extremely efficient, completing 25 of 28 for 231 yards, two touchdowns and no interceptions, while Tyreek Hill gained 80 of those yards on just four catches.

Buffalo Bills punter Sam Martin gives kicker Tyler Bass the ball to kick a field goal during a game against the Tennessee Titans at Highmark Stadium. (Mark Konezny-Imagn Images)
CLICK HERE TO GET THE FOX NEWS APP
Devon Ashen also gained 121 yards from scrimmage on the day and scored both on the ground and through the air.
Follow sports coverage on Fox News Digital's X and subscribe to the Fox News Sports Huddle newsletter.