Smith's 3-pointer with 26 seconds left put Detroit ahead 108-105, but he followed that with an ill-advised foul on Gerald Green's try from long range.
Green tied the score with three foul shots.
Smith, however, then atoned for the miscue by hitting a bank shot in traffic with 1.2 seconds remaining for the winning margin.
He also grabbed 11 rebounds as Detroit won a second straight.
The Suns got 21 points from Channing Frye en route to a third loss in four contests.
Marcus Morris and P.J. Tucker each scored 17 for Phoenix.