The Knicks averted a second straight disaster Wednesday, as it didn’t take long for Knicks center Tyson Chandler to start saving Mike Woodson’s job — and Andrea Bargnani’s hide.

With Chandler playing like a monster in the two overtimes and an exhausted and erratic Carmelo Anthony finding a good time to hit perhaps his biggest shot of the season, the Knicks escaped the BMO Harris Bradley Center with a wild and ugly 107-101 victory in double overtime over the 5-20 Bucks, the league’s worst team.

The victory allowed Bargnani a major reprieve after his brain lock nearly cost them the win. After Chandler secured an offensive rebound with the Knicks up two points, Bargnani took a shot with 13.7 seconds left in the first overtime, when he should’ve killed the clock. It may have topped Woodson’s decision not to call a timeout in Monday’s fiasco.

Chandler, playing his first game back from a broken right leg suffered Nov. 5, stabilized the defense and secured rebounds, warring through a leg cramp to make up for the Knicks’ foibles. Chandler finished with nine points, nine rebounds, three blocks and countless amount of gritty plays, forced to play 37 minutes. He cramped up in the second overtime.

The 8-17 Knicks had to overcome a sickly 37.6 percent shooting night against the 5-20 Bucks, who were without their top two scorers — O.J. Mayo and Caron Butler.

“I don’t want to think about that [if we lost],’’ Anthony said. “We won. We move forward. ‘’
Chandler’s big return nearly went all for naught because of the Bargnani miscue. After Chandler secured the offensive rebound, he whipped it back to Bargnani, who foolishly shot immediately with 13.7 seconds left despite having a new 24-second clock. It missed, the Bucks got the rebound, called a timeout with a 11.3 left and Chandler started yelling at Bargnani.

Milwaukee scored on a putback by John Henson with 0.3 seconds left in the first overtime. Instead of falling apart, the Knicks emerged in the second OT with more stifling defense brought about by Chandler’s presence.