NEW YORK -- The Boston Celtics were so disgusted by their effort that their own coach said they deserved to lose.
Maybe they can take a lesson from Earl Barron.
Barron outworked Boston's frustrated front line all night, Danilo Gallinari banked in the go-ahead jumper with 36 seconds left and scored a career-high 31 points, and the New York Knicks beat the Celtics 104-101 on Tuesday.
"We didn't execute. It was simple as that. I thought we just showed up tonight and played basketball, and we had no focus. We deserved to lose," Boston coach Doc Rivers said. "The bank shot that Gallinari hit, that was the basketball gods punishing us for not having great focus. You let them hang around, bank shots happen. I just thought we absolutely deserved that."
Barron had 17 points and a career-best 18 rebounds in his first NBA start in two years after spending most of this season in the NBA Development League.
"I've been in the D-League the whole year and been waiting for the opportunity," Barron said. "And opportunity doesn't knock many times, so I'm just trying to take advantage of it while I can."
David Lee had the clinching basket and added 13 points and 11 boards for the Knicks, who won their second straight and temporarily avoided a third consecutive 50-loss season.
Ray Allen scored 17 points for the Celtics, who blew a chance to tie Atlanta for third place in the Eastern Conference. Kevin Garnett and Kendrick Perkins each added 14 for Boston, which botched its final possession and couldn't get a tying 3-point attempt off in the final seconds.
The Celtics followed their victory over Cleveland on Sunday by losing for the fourth time in five games after leading early in the fourth quarter behind a spark from former Knicks guard Nate Robinson. They still believe they'll put it together in the playoffs, but in the meantime they can't waste games against teams they should beat.
"We've got to take everybody and respect each team in this league," Garnett said. "You've got to come to play every night. You can't pick and choose who you want to play."
Gallinari scored 19 points in the third quarter to give the Knicks an 86-78 lead, but Robinson hit a 3-pointer and assisted on Glen Davis' jumper in the Celtics' 10-0 run to start the fourth that gave them an 88-86 advantage on Michael Finley's 3-pointer.
Robinson hit another jumper for a one-point lead midway through the period, and it stayed tight from there. Gallinari banked in a long jumper -- originally called a 3-pointer but overturned after replay -- for a 102-101 lead.
Chris Duhon came up with a steal and set up Lee's basket that made it 104-101 with 7.3 seconds to play. The Celtics called time but took way too long to swing the ball to the opposite side of the court, where Rasheed Wallace caught it too late to get off a shot.
With Tracy McGrady (sore left knee) and Al Harrington (sore left ankle) joining Wilson Chandler (sore left groin) on the injured list, the Knicks had to look deep down the bench for scoring. They found it in Barron, a 7-foot center who signed last week and was playing his second game with New York. He shot 8 of 13 from the field.
"I said on the bench that he plays like Antonio McDyess, a very, very good 15-foot jump shooter," Lee said. "He's a solid post player. Defensively he's strong and has a good basketball IQ."
Robinson was perhaps the Knicks' most popular player for the last five years before he was dealt to Boston at the trade deadline. Rivers said he still considers the 5-foot-9 guard the Celtics' X-factor heading into the playoffs, but he benched Robinson on Sunday after playing him only 9 minutes in the previous game.
However, he said before the game Robinson would play Tuesday, in part because other Boston players wanted to see Robinson get in.
Robinson checked in -- or tried to, anyway -- with about 3 1/2 minutes left in the first quarter to polite, but hardly enthusiastic applause. He was sent off the court because he was replacing Rajon Rondo, who was shooting a free throw, and had to wait until the next dead ball to officially enter.
The Knicks led throughout most of the first quarter and were ahead 27-21 when it ended. Boston shot 63 percent in the second, briefly grabbing the lead late in the period before New York took a 53-52 edge into halftime.
Though Mike Krzyzewski has repeatedly said he's not interested in leaving national champion Duke for the NBA, Knicks coach Mike D'Antoni won't rule out coaching against him someday. D'Antoni is Krzyzewski's assistant on the U.S. Olympic team. "He's still only 62 years old. He's young, so I have no idea what he would do," D'Antoni said. "Wherever he goes, I do know that he would be successful, if he's coaching or running a business or whatever he wants to do. He's just pretty special." There have been reports this season that the New Jersey Nets would pursue Krzyzewski. ... Knicks president Donnie Walsh said he wasn't sure if he will sign anyone with the Knicks' available roster spot. The spot opened Monday when the Knicks waived Cuttino Mobley, who retired last season because of a heart condition. The Knicks had to waive him before the end of the season to save the luxury tax on his salary.