– On the verge of losing a game to yet another Eastern Conference team they absolutely, positively could not afford, the Timberwolves righted themselves through sheer will to beat the New York Knicks 108-104 Friday night.

By doing so, they finally outlasted a depleted team that without Kristaps Porzingis and three other players now has lost 19 of its last 22 games on its way to yet another draft lottery.

By doing so, they also won their 42nd game, which guarantees them their first winning season since Kevin Garnett, Latrell Sprewell and Sam Cassell played together in 2004-05.

Exactly one month to the night that Jimmy Butler went down clutching his knee in Houston, the Wolves improved to 6-5 and remain seventh in the competitive West without their All-Star guard with nine games remaining.

“We’re going in a good direction, but there’s more to do,” Wolves center Karl-Anthony Towns said after finishing with 24 points and 13 rebounds. “We have a lot more work to do and we have games in front of us that are just as important as tonight.”

After leading 9-2, 26-11 and 43-27 midway through the second quarter, the Wolves surrendered the third quarter’s first 15 points after the Knicks sent out a smaller, speedier backcourt featuring Trey Burke and rookie Frank Ntilikina after halftime.

They forced turnovers and played at a pace at which Knicks guard Tim Hardaway Jr. scored 19 of his 39 points in that third quarter alone.

Until then, the Wolves hadn’t trailed all night. Suddenly, they were in danger of losing to every Eastern team — yes, including Atlanta, Orlando, Brooklyn and Chicago — this season. That would be quite a feat since they play each East team only twice a season.

“I was shaking, I was 110 percent nervous,” said Wolves forward Taj Gibson, whose team is 30-15 vs. the West and 12-16 vs. the East. “I knew the stakes. I knew this was one of those games you really don’t want to let go. There are only so many games left to play. I was shaking really in my boots late.”

The Wolves persevered using a spark from reserves Jamal Crawford, Tyus Jones and Gorgui Dieng as well as their size and desperation to turn the game back in their favor finally.

“They have trees out there,” said Hardaway, who made three of his six threes in the third quarter alone.

The Wolves answered New York’s 15-0 run that opened the third quarter by outscoring the Knicks 28-9 to end the third quarter and start the fourth. That took them from seven points behind in to a 101-89 lead with 5½ minutes left.

Whenever the Knicks pushed back, the Wolves answered. Once, it was Gibson’s relentless putback basket after New York late in the game drew within five points with eight minutes left. Late in the game, Nemanja Bjelica threw himself on the floor to control a loose ball, enabling his team to chew up some clock.

Andrew Wiggins did the same with a steal on Hardaway and a stop late while he also delivered a career-high 11 rebounds. Towns blocked a shot in the final 13 seconds to keep the Knicks away.

“I’m proud of the guys,” Wolves coach Tom Thibodeau said. “It’s a collective will. We know we can’t replace Jimmy individually. We need everybody stepping up and we’ve done that.”

Gibson said he nearly lost his voice while attempting to push his teammates on and said he could see “fire in his eyes” when he looked at Wiggins late in the game. Thibodeau credited Wiggins for “hustle” plays that helped win the game.

“I just knew we had to get this game,” Wiggins said. “I looked when we were down and I was like, ‘Man, we can’t let this one slip away.’ Everyone got together and we pushed through.”