"It easily could have gotten away from us," Indiana guard Jamaal Tinsley said.
The Pacers (7-8), who led by 18 early in the game, looked safe when Dunleavy's 3-pointer with a minute left gave them a 106-97 lead. But the Nuggets rallied, and with Indiana leading 111-108 in the final seconds, Dunleavy fouled Smith on a 3-point attempt to put him on the line. Smith hit the first two foul shots, but the third bounced off the rim.
"It was ridiculous. It wasn't a foul," Dunleavy said. "He kicked me, and you just can't make that call. You have to take a guy out and you can't have a guy flop like that. It all works out and karma comes out on top, and we deserved the win."
The Nuggets, who had only 11 players in uniform, ran out of gas in the end.
"We got behind so much in the beginning, and we had to use so much energy trying to get back into the game, being so short-handed, it was tough on us," Iverson said.
But the Nuggets (9-6) nearly pulled it off. After Dunleavy's 3-pointer, Iverson and Smith hit back-to-back 3s to pull to 107-103.
Tinsley hit a free throw, and Iverson's layup made it 108-105. Williams hit two free throws, and Smith hit another 3 to pull to 110-108 with 12.5 seconds left.
Williams hit a free throw before Dunleavy was called for the foul on Smith.
"If anything, it should have been an offensive foul on Smith," Pacers head coach Jim O'Brien said.
Denver's rally nearly spoiled a night of redemption for the Pacers. When the teams met in Indianapolis on Nov. 10, the Pacers blew a 25-point first-half lead and lost 113-106. Tuesday, they scored the first 15 points of the game and led 21-3 only to see the Nuggets rally again.
"When we were up 21-3, you have so much time in the game left that you know they are going to come back and you aren't going to run away with it," said Dunleavy, whose 30 points were a season high.
Once the Nuggets started hitting shots, they got back into the game. Reserve guard Anthony Carter gave the Nuggets a spark off the bench, scoring six points to help Denver cut the lead to 27-25 late in the quarter.
The Nuggets tied the score at 37 early in the second period, and they took their first lead when Eduardo Najera hit back-to-back 3s to make it 45-44 with 4:22 left in the half.
Denver led 48-46 with 2:53 left, but the Pacers went on an 10-2 run to take a 56-50 lead into the third quarter.
Indiana trailed 83-76 with 50 seconds left in the third quarter, but scored the final six points of the period to cut the lead to one.
The Pacers took control to start the fourth, going ahead 95-86 on Dunleavy's 3 with 7:22 left.
"Seemed like in the game in Indiana we had energy at the end of the game and won the game because of it, and tonight they seemed to have more energy at the end of the game and they won the game because of it," Nuggets coach George Karl said.
Pacers C-F Jermaine O'Neal (sore left knee) sat out his fourth straight game and fifth this season. ... Karl said F Kenyon Martin (bruised right knee) could play Thursday when the Nuggets visit the Lakers. ... Williams had 11 rebounds for the first double-double of his career.