Miami suffered their third consecutive loss and slipped to 4-6 in the division with their playoff hopes becoming increasingly marginal.
The Bills got off to the perfect start with a 79 yard punt return from Leodis McKelvin and then a 32 yard field goal from Rian Lindell making it 10-0.
The Dolphins responded with a defensive touchdown of their own - Marcus Thigpen racing 96 yards on the kick-off return to narrow the deficit.
Three field goals from Lindell gave Buffalo a 19-7 lead at halftime and while Miami's offense struggled against a solid Bills defense, the Dolphins' chances were not helped by a missed field goal attempt from 50 yards by Dan Carpenter.
Miami's offense had not managed a touchdown in over nine quarters of football but they finally ended that barren run with a two yard Tannehill pass, superbly caught in the end-zone by Davone Bess.
Carpenter's miss meant that Miami needed another touchdown to win the game and while the Bills' gave them two late possessions they were unable to take advantage.
A brilliant diving catch from safety Jairus Byrd intercepted a pass intended for Bess and then, after the Buffalo offense failed to make a first down, Tannehill was picked off by Bryan Scott to end the game.