The Knicks couldn’t afford to blow this one, not after leading by 23 points in the third quarter to the depleted Bulls, not at the Garden, not with Mike Woodson’s job security in question and Amar’e Stoudemire having a throwback night. Not with a rough back-to-back staring at them this weekend.

They did blow all of the 23-point lead but they didn’t blow the game, and a beleaguered Woodson gets to coach this weekend at the least.

Despite the fourth-quarter slide that saw Chicago tie the score at 74 with 3:39 left, Stoudemire hit the big shot and the Knicks squeaked by for an 83-78 triumph Wednesday over the depleted Bulls in a small step in the right direction.

“We struggle to win games, so any game we win is important to win because it keeps us in the hunt,’’ Woodson said. “No one is running away with it.’’

Despite all the turmoil and concern over Woodson’s job and with owner James Dolan running out of patience, the Knicks have won three of their last five games. But this one should not have been the nail-biter it became.

“I think guys really realized this was a game we couldn’t let slip out of our hands from a mental standpoint,’’ said Carmelo Anthony, who finished with 30 points, 10 rebounds, four assists and three steals. “I thought we did pretty good. From a mental standpoint, if this game got away from us, there’s no telling what would’ve happened.’’

Perhaps Dolan would’ve finally made a move if they choked this away after the prior two blowout losses to Boston and Cleveland. Instead, the Knicks moved to 6-15, one game in the loss column behind the Atlantic Division-leading Celtics, whom they meet Friday in Boston. The Knicks may not have Iman Shumpert, however, after he banged knees with Mike Dunleavy (20 points) midway through the third quarter and didn’t return, diagnosed with a bruised left knee.

“It was a desperation game,’’ Stoudemire said.

Stoudemire just may have saved Woodson’s hide. He poured in 14 points on 7-of-11 shooting, sinking the go-ahead bucket with 2:34 left — a no-hesitation 18-footer from the left of the key just as Anthony was cooling off.

Woodson called it the “biggest shot of the night.’’ And perhaps the season if this was the play that keeps Stoudemire on the court in crunch time and allows Anthony not to have all the offensive focus on him.
This was the first back-to-back Stoudemire completed this season — a major breakthrough.

“I’m not surprised,’’ Anthony said. “I know the work he puts in that nobody sees in practice and before practice. It looks like it’s all coming together for him.’’

The Knicks carried a 68-54 lead into the fourth quarter against a Bulls team playing without Knick killer Luol Deng, Jimmy Butler and, of course, Derrick Rose.