Carmelo Anthony went down and Amar’e Stoudemire rose up.

With Anthony aggravating a mysterious, nagging, right-knee injury in the second quarter, Mike Woodson was forced into playing Stoudemire past his 30-minute, team-imposed cap for the first time this season.

It was a desperate move and it worked splendidly. Stoudemire carried the Knicks from 22 points down in the second quarter and powered a thrilling 102-97 victory over the Cavaliers at Quicken Loans Arena, playing a season-high 31:55.

As Anthony sat in the locker room, his immediate fate unknown, Stoudemire bagged 22 points, made 10 of 15 shots and looked like “The $100 Million Man’’ again. It was tied for the Knicks’ second-biggest comeback since 1991-92.

“I told you guys, whenever my number’s called I’ll be ready,’’ Stoudemire said in a giddy Knicks locker room. “Tonight I was ready.’’

A somber Anthony claimed the injury is not serious, although the medical staff still can’t determine why he’s been in discomfort for about two weeks. Anthony left the game midway through the second quarter after tripping over himself and landing hard when he tried to receive a Jason Kidd pass.

Melo, 1-of-5 at the time, walked off to the locker room with the club down 21 points with 6:42 left in the half and didn’t return.

Stoudemire came in for Anthony and the Knicks (36-21) exploded on a 10-0 run — the foundation for their comeback.

“When there’s a will, there’s a way,’’ Stoudemire said. “We willed out a win tonight.’’

Anthony said he doesn’t know if he’ll be ready for Detroit tomorrow; he’ll be reevaluated today.

“No, no. It’s definitely not serious,’’ Anthony said.