MIAMI GARDENS, Fla. (AP) On the brink of elimination from the playoff race, the Indianapolis Colts dug in.

Their defense made a last-minute stand, third-string quarterback Charlie Whitehurst again came off the bench and the Colts kept alive their faint postseason hopes Sunday, beating the Miami Dolphins 18-12.

Miami had first-and-goal at the 5 with 40 seconds left, but after three consecutive incompletions, rookie backup center Jamil Douglas snapped the ball prematurely, and Ryan Tannehill was sacked by three Colts.

More from FoxSports

Indy backup quarterback Matt Hasselbeck left with an injury for the fourth game in a row, and Whitehurst did just enough in relief, completing two scoring drives.

The Colts (7-8) would have been out of the playoff race with a loss, and they can still be eliminated in Week 16 if Cincinnati wins at Denver on Monday.

''We did our job today,'' Whitehurst said. ''That's kind of what we can control. We need a little bit of help. Hopefully it goes our way, and we'll have a fun week of practice and have something to play for next week.''

Miami (5-10) was eliminated two weeks ago, and a half-empty stadium reflected the sad state of the franchise. The Dolphins have lost three in a row and are 4-7 under interim coach Dan Campbell, who is likely to be replaced after the season.

The Dolphins couldn't beat a third-string QB. Indy's Andrew Luck missed his sixth consecutive game with a lacerated kidney and a partially torn abdominal muscle, and Hasselbeck left in the second quarter with a right shoulder injury.

Whitehurst completed a third-down pass on his first play, setting up the Colts' second touchdown for a 15-6 lead. He also directed a 10-play drive early in the fourth quarter for a field goal that made it 18-9.

''I did OK, and I got a lot help,'' Whitehurst said. ''The defense really delivered.''

Whitehurst was limping after being sacked on third down with three minutes left, and the Colts had no quarterbacks left to replace him. But he was needed for only one more snap - out of the victory formation on the final play.

Hasselbeck said he was ''not super optimistic'' he would be available to play next Sunday against Tennessee.

''We'll do an MRI Monday, but I think it's just an AC sprain, which is great news,'' Hasselbeck said. ''I had this injury to my left arm a long, long time ago, so I kind of know it's not that serious. It's just a matter of how quick.''

The afternoon was rough on quarterbacks for both teams. Tannehill was sacked six times, hurt his left leg late in the game and walked with a limp in the locker room.

''It's not easy to win when quarterbacks get hit,'' he said. ''That's something we have to fix.''

The Colts' season-high sack total included rookie T.Y. McGill's first career sack for a safety and the game's first points. Robert Mathis was credited with the final, game-clinching sack thanks to the botched snap by Douglas, who was filling in for injured Pro Bowl center Mike Pouncey.

''He feels like it's on his shoulders, but it's not,'' Campbell said. ''There are enough mistakes to go around, offensively and defensively. It's never one man's fault.''

The defense allowed Frank Gore to rush for 85 yards and score the Colts' touchdowns on runs of 37 and 11 yards. The South Florida native was playing in Miami for the first time.

Tannehill threw for 329 yards, but was intercepted in the end zone by Vontae Davis to end a Dolphins threat. A questionable offensive pass interference penalty on the Dolphins' Jarvis Landry negated a Tannehill touchdown pass to Jordan Cameron, and they settled for a field goal.

Landry became the first Miami player to have 100 catches in a season. He had seven receptions for 111 yards, including a sensational one-handed catch as he tumbled to the turf for a 26-yard gain.

Notes: Dolphins LB Jelani Jenkins aggravated an ankle injury and left the game in the third quarter. ... Colts guard Hugh Thornton left the game in the first half with an ankle injury. ... The Colts' Adam Vinatieri joined Morten Andersen and Gary Anderson as the only players in league history with 500 field goals. However, Vinatieri missed an extra point for the third time this season.

---

AP NFL website: www.pro32.ap.org and http://twitter.com/AP-NFL

---

Follow Steven Wine on Twitter: http://twitter.com/Steve-Wine