Marvin Bagley III led Detroit with 27 points, and Cunningham added 18.
Detroit pulled to 80-79 after holding New York to 21 points in the third quarter and tied it at 83 with 9:56 to play.
Quickley answered with a 3-pointer and his dunk drew a Pistons timeout with New York up 90-86 with 7:07 to play. Detroit tied it again at 90, but Randle’s 3-pointer sparked a 7-0 run.
Bagley dunked over Randle and made a free throw to pull the Pistons to 99-96 with 2:09 left, and Saddiq Bey made two free throws to make it a one-point game with a minute left.
Burks’s 3-pointer made it 104-100, but Hayes cut the margin in half with a layup. Barrett’s fadeaway jumper missed, and Bey grabbed the rebound to set up the final possession.
Knicks: Former Pistons and Knicks player Allan Houston, now a member of the New York front office, met with Pistons guard Bey to congratulate him before the game. Bey broke Houston’s franchise record for single-season 3-pointers this week.
Pistons: Cunningham moved past 1,000 points in the first half of his 59th career game. The first overall pick last summer is averaging 17.1 points.
Knicks: Host Chicago on Monday night.
Pistons: At Brooklyn on Tuesday night.
Source: Yahoo Sports