Arron Afflalo went from understudy to star in an instant.
With Carmelo Anthony fouled out, Afflalo took over the All-Star's role and came through.
"I've hit some big shots before, but never have I made the game-winner at the buzzer," said Afflalo, who scored 19 of his 24 points in the fourth.
"I'm really, really happy for him," Chauncey Billups said. "When I see the way he works on his game, day in and day out, and finally reap some of the benefits of that, it makes you proud."
Afflalo became the star when Anthony fouled out with 19.6 seconds left and the score tied at 119. Dirk Nowitzki hit one free throw and the Nuggets went down for the final shot with Afflalo playing Anthony's role.
"If Melo was in the game we were going to stick him in the corner and see if we could get the pick and roll with Chauncey and Nene," Nuggets coach George Karl said, "but we had to change positions and put Arron down there."
Billups was double-teamed on the play and kicked it out to Afflalo, who took one dribble to shake Shawn Marion and get open.
"Chauncey did a great job of being patient. When he figured he wasn't going to get enough space to get a clean shot off I was just ready," Afflalo said. "That was all I had in my mind, get a clean look."
He did and put a stop to the streaking Mavericks.
"It was a tough finish," Nowitzki said. "Afflalo was basically a non-factor for three quarters and all of a sudden he throws everything in that he got."
Anthony scored 42 points and Billups had 30 for Denver, which overcame a nine-point deficit in the last 2:51 to win.
Jason Terry scored 25 points, Tyson Chandler had 20 points and 11 rebounds and Nowitzki finished with 16 for the Mavericks.
"This is the NBA," Dallas guard Jason Kidd said. "You win games sometimes when you're not supposed to and you lose games when you're not supposed to."
The win stopped Denver's recent slide and came a day after Anthony gave Nuggets fans a ray of hope he would stay with the franchise.
Anthony told the Denver Post on Wednesday before Denver's game against Golden State that he would "take a real hard look" at signing the three-year, $65 million extension the Nuggets offered last summer if he is not dealt before the Feb. 24 trade deadline.
Anthony has been mentioned in trade talks with New Jersey, Chicago, New York and the Los Angeles Lakers since the start of the season.
The Nets were his hottest pursuers until owner Mikhail Prokhorov announced last month his club was no longer trying to deal for Anthony.
Anthony has said in the past he has wanted to keep his options open and wasn't opposed to playing the entire year in Denver.
Until Wednesday he had not indicated he was open to signing the extension and staying in Denver beyond this season. His play of late has given fans something to cheer about. He is averaging 37.5 points over his past five games, including a 50-point effort against Houston on Monday.
"There's a lot going on, not just for me, but for the whole organization," Anthony said. "When we're winning basketball games, nobody even notices that stuff. When you lose it's magnified 100 times."
Dallas, which trailed by 18 in the first half, took control in the third and tried to pull away in the fourth. Denver led 75-71 when the Mavericks went on a 13-2 run to take the lead.
Dallas led 92-88 heading into the final 12 minutes when Terry hit a 3-pointer and a jumper as the Mavericks scored the first nine points of the fourth to take a 13-point lead.
After sitting out Wednesday with a left knee strain, Billups was aggressive offensively in the first quarter, hitting four 3-pointers and scoring 18 of the team's first 31 points and the Nuggets took a 33-19 lead.
"I had some open shots early and it kind of snowballed," Billups said. "It was a great quarter."
Denver quickly pushed the lead to 18 early in the second before Dallas rallied behind its bench, which scored 31 of the team's 39 points in the period.
The Mavericks trailed by 18 before Chandler's free throw with 1:09 left in the half tied the game at 54. Jose Berea hit a 3-pointer to put the Mavericks up 58-56 before Anthony hit a 3 to give Denver a one-point lead at the break.
Notes: Miami Dolphins receiver and former Denver Broncos player Brandon Marshall was sitting courtside. ... With Jerry Sloan resigning as Utah's coach, Denver's George Karl is now the third-longest tenured coach in the NBA. Karl took over the Nuggets in January 2005. Karl said he was shocked and saddened by Sloan's resignation. "I can't tell you I'm not emotionally drained by the decision. I heard about it last night a little bit and then it came to fruition, it was a tough one to swallow."