HOUSTON (AP) -- Tracy McGrady heard the groans from the crowd, and with every missed free throw, they got louder.
Tracy McGrady scored 29 points and Yao Ming added 21 points and 13 rebounds as the Rockets nearly entered the NBA record book for foul-shot futility before beating the Pistons 80-77.
The Rockets missed 14 of their first 15 shots from the line, before finishing 6-for-22 (27 percent) to win for the third time in seven games.
"It's mental. It's just you and the basket," said McGrady, who missed all five of his attempts. "And the fans definitely don't make it easy on you. Every time you miss, [they say], 'Awwww!' 'Awwww!' That's the worst thing you can do to a player -- especially at home."
Bonzi Wells went 2-for-9 from the free-throw line. Luther Head went 1-for-2. Even Yao, an 88-percent shooter from the line, was off, going 3-for-6.
"Oh, man. We can lose a game because of that," Yao said. "Tomorrow, I'm going to come here and shoot at least 100 free throws. It's almost like you give away free points and give away a game."
Houston wore throwback uniforms and it was all too fitting -- the 1983 Rockets went 3-for-14 from the free-throw line (21 percent) in a 113-107 loss to Portland. Toronto is the only team in history to not make a free throw in a regular-season game, missing all three attempts in a game against Charlotte in 1996.
Good thing for the Rockets, the Pistons seemed to miss from everywhere else on Wednesday.
The Pistons had won seven of their previous eight by an average of 20 points.
"We did one good thing," Detroit coach Flip Saunders said. "We defended very well at the free-throw line."
The Rockets built a 49-35 lead early in the second half, but kept the misfiring Pistons in it with their awful free-throw shooting.
Detroit went on a 16-6 burst to cut the deficit to 55-51 and McGrady then missed his next four shots from the line. The Pistons went 10-for-17 from the field in the third quarter after going 12-for-44 in the first half.
Wells ran for a two-handed dunk and was fouled to open the fourth quarter. But Wells missed the ensuing free throw, dropping the Rockets to 1-for-12 in the game.
McGrady offered no good explanation. The Rockets came into the game shooting 74 percent from the line, not spectacular, but far from this terrible.
"I've never seen a night like that, where we miss so many free throws -- and won the ballgame," he said.
Wallace sank a pair of free throws at the other end and Donald Murray's layup with 10:43 left tied the game at 59-all. Wells missed three more free throws before sinking one with 8:06 left, snapping a streak of 11 consecutive misses and drawing mock cheers from the crowd.
"That's the way to defend us," Yao said. "Just foul us, we'll miss free throws, grab the rebound, come to us."
But the Pistons went cold again, missing five consecutive shots. Rafer Alston's 3-pointer with 6:49 left triggered a 10-0 Rockets run.
Hamilton sank a 3-pointer with 3:52 remaining, as Detroit mounted one more surge. Wallace hit a 3-pointer and Hamilton sank another one to pull the Pistons to 79-77.
Yao missed a shot with about 30 seconds left and the Pistons rebounded. Billups lost the ball out of bounds, but referees said the Rockets touched it last with 11.4 seconds left.
Wallace, then Billups, missed 3-point tries in the closing seconds and Yao rebounded the second miss.
"It felt good," Billups said, "but that's an indication of the way things went. I had a good look. It didn't fall."
Wallace fouled Yao and Yao stepped to the line with 0.8 seconds left. He missed the first but made the second to put Houston up 80-77. Detroit called time out and Antonio McDyess lost the ball on an inbound pass as time expired.
The Pistons had won six of the previous seven meetings with Houston.
Detroit's 16 first-quarter points matched a season low and its 33 first-half points set a new season low. ... McDyess twisted his left ankle when he landed on Wallace's foot in the fourth quarter. ... Alston started after missing the last two games with a strained groin. ... Both teams wore retro uniforms -- the Rockets, from their 1994-95 championship season and the Pistons, from their inaugural 1957-58 season.