The Charlotte Bobcats' 16-game losing streak is over.
It was their first victory since January 14 and snapped a franchise-record skid that gave Charlotte the worst record in the NBA.
"It's wonderful to win," said Bobcats coach Paul Silas, whose team moved to 4-26 for the season.
Williams carried the Bobcats in the first half, scoring 16 of his 22 points, while rookie Kemba Walker led them with 10 points in the second half and ended with 14 off the bench.
Charlotte out-scored Toronto 30-22 in the fourth quarter, beating the Raptors for the fifth straight time after sweeping last season's four-game series.
Bismack Biyombo added a career-high 13 rebounds, seven blocks and eight points for Charlotte and D.J. Augustin scored 11 with 10 assists in his second game back from a toe injury.
DeMar DeRozan had 24 points to lead Toronto, but just six after halftime as he got into foul trouble. Leandro Barbosa added 16 points off the bench but the Raptors lost their fourth straight and fell to 1-7 in their last eight games.
"Totally disappointed," said Raptors coach Dwane Casey. "We didn't focus well at the start."
The Bobcats are 2-15 on the road this season, including 1-1 on a three-game trip that ends Sunday against Indiana when they will try to earn back-to-back wins for the first time this season.
They shot 50 percent in the game and held off Toronto down the stretch. Maybe fittingly, the basket that sealed the win came on a broken play after Augustin lost the ball as he drove near the top of the paint.
It flitted into Boris Diaw's hands, and he delivered a clumsy pass to D.J. White under the basket for a layup that gave the Bobcats a 96-91 lead with 15.8 seconds left.
As bad as things got for the Bobcats, their losing streak ended 10 games shy of Cleveland's NBA-record 26 last season.
"You have to play hard. You've got to, whether you win, lose or draw," said Silas. "I just told [the team] that was a great game, bring it in. They were complimenting each other. I didn't have to say anything."
Guarding each other, Williams and DeRozan scored 34 of their teams' 92 points in the first half, including 27 of the 45 points scored in the first quarter.
Williams had 14 in the opening quarter and DeRozan scored 13, helping Toronto take a 23-22 lead. The Bobcats shot close to 49 percent in the second quarter and had a 47-45 lead at halftime.
Walker scored seven points in the third quarter and Charlotte shot 50 percent, but the Raptors inched ahead for a 69-68 advantage. Charlotte took the lead for good on Walker's three-point play to open the fourth quarter.
"This is a great win. We came in and played tough," said Walker. "Coach has been keeping us level through the streak."
Asked what it felt like to be part of such a long losing streak after winning the national title with Connecticut last year, Walker offered a quick history refresher.
"Everybody keeps asking me," said Walker. "Last year in the Big East we were only 9-9 and we ended with an 11-game winning streak. I said it before, it's a process."
The Raptors fell to 1-5 on a seven-game homestand that ends Wednesday versus Detroit -- their only remaining game before the All-Star break.