Detroit Pistons coach Monty Williams was "almost in tears" after Saturday's 129-127 win over the Toronto Raptors, which saw his team avoid setting a new record for most consecutive NBA losses.

Detroit matched the longest losing run in NBA history on Thursday, when they blew a 21-point lead against the Boston Celtics to equal the Philadelphia 76ers' record of 28 straight losses covering the end of 2014-15 and the start of 2015-16.

The Pistons – who were on the worst single-season losing streak in league history – could have taken that unwanted record outright when they welcomed Toronto to Little Caesars Arena, but Cade Cunningham starred as they avoided doing so.

The third-year guard had 30 points and 12 assists as the Pistons clinched victory over their short-handed opponents by going 11 for 12 from the free throw line in the final minute.

Asked about the mood in the Detroit camp after the team's first win since October 28, Williams said: "I've been a ton of locker rooms my whole life, and that's a first for me, to have that.

"It wasn't relief, it was like: 'Thank God'. Guys were screaming. I was almost in tears. I'm just so happy for our guys. I'm happy for everybody.

"Sometimes it just takes a win like that to get things started. I just have so much respect for our team."

Cunningham, who hit back-to-back three-pointers in a crucial fourth-quarter stretch to pull Detroit clear, added: "I feel amazing.

"We just kept battling. It's been a long stretch, all these losses, but I'm just happy to be part of a group of guys who don't quit."

Pascal Siakam scored 35 points and Dennis Schroder added 28 for the 12-20 Raptors, who traded O.G. Anunoby, Precious Achiuwa and Malachi Flynn to the New York Knicks earlier on Saturday and were unable to field new arrivals RJ Barrett and Immanuel Quickley.

They sit 12th in the Eastern Conference after losing five of their last six games, while the last-place Pistons are at 3-29 ahead of a four-game road stretch starting against the Houston Rockets on Monday.