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.
Senate Democrats to pull all-nighter on climate change
Interpol investigating stolen passports on missing flight