James Harden scored 37 points and Aaron Brooks made a pair of free throws with 17 seconds left to lift the Rockets to a 102-100 victory.
The Knicks had a chance to tie it at the end, but Iman Shumpert missed a shot before Andrea Bargnani grabbed a rebound and dished it to Beno Udrih, whose running jump shot rolled in and out of the basket at the buzzer.