Brandon Knight made a layup with 8 seconds remaining Friday to give Detroit a 91-90 victory over Toronto.
The Pistons won for only the third time this season and handed the Raptors their third straight loss.
The game was closely contested throughout and Toronto missed a chance to take a three-point lead when Kyle Lowry failed to connect on a jump shot with 21 seconds to go.
After a time out the Pistons worked the ball to Knight for his game-winner and Detroit then survived a missed 3-point try to Lowry just before the buzzer.
Detroit also overcame a 34-point performance from Andrea Bargnani, who made 13-of-20 field goal attempts.