BOSTON — Trey Burke likes to talk about weathering the storm – his catch-all metaphor for surviving these grueling growing pains that the Knicks are experiencing and, hopefully, coming out the other side a little wiser, a little tougher, and a lot better.

But for the Celtics on Wednesday night, Trey Burke was the storm.

In a surprising and spirited display, the Knicks took a gigantic lead and withstood a scary late flurry by the Celtics, defeating them, 117-109, at TD Garden to snap a six-game losing streak.

The Knicks (5-14) led by 26 in the second quarter but saw that lead go down to three with 34.8 seconds left. Then Burke, a force of nature all night, confidently hit a pull-up three-pointer from the top of the key with 12.9 seconds left to seal it. Burke had 29 points, 11 assists and six rebounds off the bench in a coup for the Knicks – a victory over one of the most hyped teams in the NBA in the second game of a back-to-back. It was, in every respect, a win few could see coming.

“In the storm, you learn a lot about yourself,” Burke said. “You’ve got to figure out ways to get out of it. Tonight, we made just enough plays to pull it out. It was a big win for us. We’ve got to build off of this.”

“They don’t cave in,” coach David Fizdale said. “I think everybody can see that. I think even despite our record and the losses that we’ve had, these kids are serious about their profession. They come to work hard every day.”

Subscribe to Newsday’s sports newsletter

Receive stories, photos and videos about your favorite New York teams plus national sports news and events.

Fizdale had reason to be pleased, considering this win made him look pretty smart. Despite the loss to the Blazers Tuesday, he liked what he saw from his starting five then, and used the same guys Wednesday – a lineup devoid of rookies. This one included Enes Kanter, who prior to Tuesday hadn’t started since Oct. 24, and a backcourt of Emmanuel Mudiay and Tim Hardaway Jr.

What resulted was a team that yes, showed signs of youth, but never really took its hand off the throttle, even when the Celtics threatened. They led 65-49 at the break and enjoyed the uncommon thrill of being the reason the Celtics were booed in their own house – the wrath of New England raining down on them as they entered the tunnel at halftime.

The Knicks never trailed and had a double-digit lead for nearly all of the second half. Marc Morris’ three with 2:18 left cut it to nine, and Irving’s layup made it 110-103. Jaylen Brown’s free throw eventually cut it to 112-109 before Burke’s three.

“It was Trey,” Fizdale said, referring to how the Knicks were able to hold it together, even though they’ve made a habit of wilting late in games. “There was one key, and it was Trey. He really carried us home.”

Burke, who scored 31 against the Pelicans Friday, said it’s all been a change of mindset. He’s stopped reading the press about him, he said, and doesn’t look at the comments on Instagram. The outside noise was being too much, and, after all, it does no good to be distracted when you’re trying to weather a storm.

“I shot it confidently – you know, a shot that I work on every day,” he said of his final basket. “It dropped…[Earlier in the season, I was] being conservative, letting the game come to me. That’s not who I am as a player, and I don’t think I’ll do this team that much service if I come in passive. I’ve got to be aggressive …That’s who I am.”