Denver's Kenyon Martin missed two foul shots with 2.6 seconds left, and Yao got the rebound to clinch the win. But the Nuggets felt they had the go-ahead basket wrongly taken away on their previous possession.
Yao missed with 18 seconds left, Martin rebounded and Denver coach George Karl called timeout. Linas Kleiza drove into the lane and passed to Nene for a dunk. But the basket didn't count because referee Bennett Salvatore called a charge on Kleiza for running into Chuck Hayes.
"I thought it was definitely a flop," Kleiza said. "I definitely didn't feel like I hit him. But, oh well. It's done. We've got to move on."
Aaron Brooks hit 1-of-2 from the line with 6.5 seconds to go and Karl called one more timeout.
Chauncey Billups fed Martin cutting down the lane, and he was fouled. Martin came into the game making 58.3 percent of his free throws.
The Nuggets were too steamed about Salvatore's call on Kleiza to blame Martin for the loss.
"L.K. made a great play," Karl said. "It was a great play that won the game. We're just going to go home without a win."
J.R. Smith scored 24, Nene had 23 and Martin 22 for the Nuggets, who lost for just the third time in 12 games.
"We had great effort," Karl said. "My big guys battled Yao and got beat up a lot. He's a tough cat, gets away with a lot of holding, grabbing and dislodging. There are losses that are good losses. Tonight was a good loss. We did a lot of things well."
"He was terrific," Houston coach Rick Adelman said. "He made some really positive plays."
Yao, who went 12-for-12 from the field in a win over Miami on Saturday, missed his first two shots on Monday. Alston sank his first five shots, including three 3-pointers, to carry the Rockets early.
Yao spun for a dunk 90 seconds into the third quarter, then drew his fourth foul going for an offensive rebound on Houston's next possession. The Nuggets continued their accurate shooting, hitting five of their first eight after the break to build an 80-73 lead.
Denver finally started missing and the Rockets finished the third quarter with a 17-7 spurt to take a 90-87 lead to the fourth. The Nuggets scored 64 points in the first half, but mustered only 19 in the third quarter.
"Our defense in the second half was key," Yao said. "In the first half, they shot way too many layups. We did a better job in the second half."
Smith started the final quarter with a pair of 3-pointers to put the Nuggets back in front. He hit four 3s and went 6-for-10 from the field in the fourth quarter.
"I tried to do what I do," Smith said. "Just keep shooting, just try to get my rhythm."
Billups broke a 103-all tie with Denver's eighth 3-pointer with 6:27 left. Yao argued a traveling call at the other end and got a technical foul and Billups' free throw put Denver up 107-103.
"It was one of those games where you kind of had to claw your way back into it," said Brent Barry, who scored 11 for Houston. "It's kind of like the person who is going to score last is going to win."
Yao's hook shot with 1:41 left gave the Rockets a 114-110 lead. Smith hit his fifth 3-pointer with 1:05 remaining to cut Houston's lead to one.
Martin topped 20 points for the fourth time this season. ... Wafer has scored in double figures in nine straight games. ... The Rockets' first-quarter and first-half point totals were season highs; Denver's first-quarter and first-half point totals were season highs for a Houston opponent.