Raja Bell made sure of it, hitting a 3-pointer with 50 seconds remaining, then sinking two free throws after Detroit cut it to one again, leading Utah to a 102-97 victory.
Williams added a pair of free throws for the final points.
The Jazz (24-11) now have won 11 straight against Detroit (11-23), with the Pistons' last win coming March 23, 2005.
"It feels good," said Millsap, who finished with 15 points and 10 rebounds. "We gutted it out. They ran off a lot of screens and were getting any look they wanted. They missed a few shots down the stretch, and we made some big plays."
The wild finish erased yet another slow start for the Jazz, who fell behind 22-16 early and trailed 79-78 entering the fourth.
"The good thing is we're a closing team," Bell said.
"We've been in tight games this year and kept plugging away. You could see us really close ranks there in the fourth quarter and start executing our stuff."
Bell also was confident he'd get his chance, even if he was 0-for-2 from 3-point territory before the game winner.
"I'd missed a few early in the game but had a feeling I would get another look at one," he said. "You stay ready, then jump up there and shoot."
The shot erased a fine performance from Prince, who led Detroit with 26 points on 11-of-19 shooting. McGrady, meanwhile, had 11 points, 11 assists and nine rebounds.
"I thought he was outstanding," Detroit coach John Kuester said of McGrady. "He did a good job of controlling the pace of play, making good decisions with the basketball. Eleven assists with one turnover is very impressive."
Bell wasn't surprised.
"I know his knees aren't what they used to be, but he's one of the most talented guys ever to play the game," Bell said of McGrady. "When he was in his prime and the knees were healthy, he was as good as anybody."
Despite Utah's run against the Pistons, this one was close from start to finish.
The game was tied 15 times with 11 lead changes. While Utah held a 38-28 advantage in points in the paint, the Pistons held a 39-35 edge in rebounds.
Utah had all five starters plus C.J. Miles score in double figures.
The Jazz went on a 16-4 run in the second quarter to take a 41-32 lead. Utah's reserves once again were the spark, with Ronnie Price igniting the crowd with a dunk and a twisting layup, and Miles adding a put-back, three-point play and 3-pointer.
Miles led Utah in scoring in the first half with 11 points as the Jazz took a 53-51 lead into the locker room. He scored just one point in the second half.
"I'm exhausted," said Miles, who missed two games because of flulike symptoms. "I ran out of gas in the second half, but I'll be all right. I just need to get some extra work in just to get running again. I've been basically laying down the last four days."
Jazz players knew the Pistons wouldn't lie down.
"I know their record kind of doesn't reflect it right now, but they're surely a dangerous team, in a tight ballgame especially," Bell said. "It was tough. We had opportunities to put some distance between us. But ultimately we got the win."
Stuckey returned to action after battling a stomach ailment. He did not start but played nearly 14 minutes and scored three points. ... Jazz reserve C Mehmet Okur missed his third straight game with a lower-back injury. ...Jefferson finished with 16 points, eight rebounds and thee blocks. ...Jazz coach Jerry Sloan was asked, in light of the Seattle Seahawks hosting a home NFL playoff game, whether it would be OK if that occurred in the NBA. "Are they supposed to apologize?" Sloan said after noting Dick Motta won a championship in Washington despite winning just 44 games during the 1977-78 regular season.