The Dolphins improved their playoff chances by winning their second straight and reaching the .500 mark after 10 games. Carolina fell to 4-6.
Williams scored twice in the second period -- on a 14-yard pass from Chad Henne and on a 1-yard run -- to give Miami a 14-3 halftime lead.
Carolina closed within 17-14 with 5:18 to play in the game on a 27-yard throw from Jake Delhomme to Steve Smith but Williams scored the decisive touchdown on the fourth play of a 59-yard drive. His 46-yard dash came with 3:55 to go.
The Panthers settled for a John Kasay field goal with 1:41 left that brought them within seven but Miami recovered the ensuing onside kick. Carolina regained the ball on a punt with 39 seconds left and reached the Miami 26-yard line before a desperation throw on the game's final play fell incomplete.
Williams ran for 119 yards on 22 carries and caught two passes for 19 yards.
Delhomme could complete just 19-of-42 passes for 227 yards with one touchdown and an interception.
Swim Week Miami Beach 2014 [PHOTOS]