Gerald Wallace throws his headband as the Knicks celebrate their...

Gerald Wallace throws his headband as the Knicks celebrate their victory over the Nets at Barclays Center. (Dec. 11, 2012) Credit: Jim McIsaac

Deron Williams flashed a devilish smirk when Jason Kidd's name was brought up.

"I hate him," the Nets point guard said, drawing laughs.

From the Nets' perspective, though, there wasn't anything funny about the way Tuesday night's game with the Knicks ended. With a Barclays Center sellout crowd of 17,732 on its feet, waiting to see how this thriller was going to shake out with the game tied in the waning seconds, it was the former Net and the guy who wasn't available when these teams met two weeks ago who hit the game-winning dagger.

Kidd nailed a three-pointer with 24.1 seconds left while getting fouled by Jerry Stackhouse, sending the Nets to a 100-97 loss before a boisterous audience whose rooting interests seemed to be split right down the middle. It's the fifth straight defeat for the Nets (11-9), continuing their trend of controlling the action early, only to see the game snatched from them at the end.

They led by 17 points in the first quarter and were up by seven in the fourth before the Knicks (16-5) pulled it out.

"It was tough," Williams said. "It was a tough game for us. We went up big again in the first half and let them get some life there at the second quarter, and then we came out a little sluggish again in the third and then got the lead. It was just back and forth from there on. They played a heck of a game, especially defensively in the fourth quarter.''

Andray Blatche paced the Nets with 23 points. Williams added 18 points and 10 assists, Gerald Wallace had 17 points and Joe Johnson had 16. Reggie Evans grabbed 18 rebounds.

Carmelo Anthony pumped in a game-high 45 points for the Knicks, 15 in the fourth. He combined with Kidd to score the Knicks' last 19 points.

"Carmelo was hitting twos, threes, fours and fives," Stackhouse said. "So we just kind of got in a scramble there and we decided we were going to take the ball out of his hands. Then when we did that, we were just kind of scrambling, scrambling . . . I thought I still closed out pretty good. He made a tough shot."

Kidd's bucket was the biggest of the game. However, there was a play a few minutes earlier involving Blatche that was a key. Johnson's floater bounced off the rim and Blatche tipped it in, initially giving the Nets a 93-91 lead with 3:02 left.

But referee Bill Kennedy, standing in front of the Knicks' bench, blew the whistle as the Nets were starting to run back on defense, ruling it offensive goaltending.

"I thought it was a clean putback," Blatche said. "But a lot of my teammates said it was still on the rim."

Even so, the Nets had a chance to tie it after Kidd's three-pointer. But Wallace's three-pointer with five seconds left rimmed out and Williams' desperation three-pointer at the buzzer clanked off the rim.

"We need to get a win and I need to play better," Williams said. "I don't feel like I've had a good game yet this season. Tonight I had 18 and 10, but still that's not a good game for me. That's an average game. I need to try to get back to dominating games. I'm trying to find the rhythm out there.

"It's just not happening the way I'd like it to for whatever reason, and I've just got to be more aggressive, I guess."

Newsday LogoCritical LI Information You NeedDigital Access$1 for 5 months