Carpenter's game-winning boot with 33 seconds left came after Mario Williams sacked Dolphins quarterback Ryan Tannehill to force a fumble. Kyle Williams recovered the loose ball at the Miami 34-yard line with 2:48 remaining.
On the ensuing possession, Fred Jackson's 10-yard reception on third-and-4 kept Buffalo's drive alive before Carpenter sent his kick straight through the middle of the uprights, enabling the Bills (3-4) to snap a two-game losing streak.
Backup quarterback Thad Lewis, subbing for EJ Manuel (knee sprain), managed 202 passing yards with an interception in the victory.
Nickell Robey helped the Bills' cause with a 19-yard interception return for a touchdown early in the first quarter.
Tannehill finished with 194 passing yards and three touchdowns, but threw two interceptions for Miami (3-3), which fell for the third straight game.
Celebrity Couples of 2014 [PHOTOS]