Cleveland wasted a 42-point performance by Ricky Davis.
Davis became the first player in franchise history to have three 40-point games in a season but had little help down the stretch. Cleveland blew a six-point lead in the final minute of regulation and a four-point edge in the extra session en route to its 13th straight road loss.
The Cavaliers had a 105-101 lead with 3:57 left after Davis scored five straight points. But Detroit's Ben Wallace had a follow dunk and, after the teams traded baskets, Hamilton and Williamson each made a pair of free throws to forge a tie.
Wallace blocked rookie Dajuan Wagner's shot at the other end and Williamson made a running hook shot over DeSagana Diop with 7.2 seconds left.
Davis, who forced some ill-advised shots in overtime, gave up the ball on the final possession, but Jumaine Jones missed a wide-open three-pointer at the buzzer.
Wallace collected 11 points, 19 rebounds and four blocks for the Pistons, who had six players in double figures and improved to 11-2 at the Palace of Auburn Hills.