Carmelo Anthony said after Saturday’s debacle in Philadelphia he “couldn’t throw a rock into the ocean.’’

Last night, in sweet, record-tying redemption, Anthony filled up the ocean with 3-point daggers and then snapped a late-fourth-quarter funk with a traditional 3-point play off an exploding drive that won the game.

It was the very best of Anthony’s inside-outside brilliance. In notching the game-winner, Anthony took a pass from Raymond Felton on the left elbow, immediately burst past Josh Smith and past Atlanta, 106-104 in a wild Garden shootout.

Trailing by one, Anthony rolled in the layup with 12.5 seconds left while getting hacked on the play. Anthony made the free throw, capping his 42-point night.

“It was just a matter of not letting Josh Smith set his feet,’’ Anthony said. “Just catching it and going. I knew that if I could get just one step in front of him and catch him off guard, I would have a chance of getting the ball up and get the shot I wanted. I knew he was probably banking on me holding the ball out for the last shot.’’

Anthony set his career high for 3-pointers with nine, which tied the Knicks’ franchise record for 3s in a single game. He also tied the franchise record held by Richie Guerin for 29 straight games with 20-plus points. It was a crazy night as the Hawks shot 60 percent — a season-high against the Knicks — and still lost.

In the Philly rout, Anthony was 0 for 6 from 3-point land and in the past seven games, he was shooting 68 of 187 (36.3 percent).

“Tonight was one of those must wins, I’m glad we were able to bounce back from that disaster against Philly,’’ said Anthony. “That’s the joy of the league — you have games one night and the chance to redeem yourself the next night.’’

As good as this season has been, Anthony hasn’t had a traditional game-winner before last night. And coach Mike Woodson was growing concerned about Melo’s recent low shooting-percentage games. Last night he was 15 of 28 — 9 of 12 from 3-point land. Anthony tied Latrell Sprewell, Toney Douglas and John Starks at nine.

“He needed a breakout,’’ Woodson said. “He’s been scoring, but he just hasn’t been shooting at a high rate. Tonight I couldn’t rest him. In the third and fourth quarter, he came up big with big shots.’’

“My shot, it’s falling once again,’’ Anthony said. “When you’re feeling it like that, you feel like you can’t miss. My shot tonight came in rhythm. Everybody played within the rhythm of the game. It felt good out there.”

Anthony wasn’t aware of the 3-point record until afterward as he had nine entering the fourth quarter.

“Until I came in here and someone asked me why I didn’t take my 10th, try to make my 10th,’’ Anthony said. “No, I did not know [until then].’’

After Melo’s 3-point play, Atlanta nearly won it at the buzzer as surging point guard Jeff Teague (27 points) penetrated and whipped the ball back to Smith, who back-ironed a wide-open 3-pointer at the buzzer.

Felton made his impact felt in his second game back from a broken pinkie. Several of Anthony’s 3-point looks came off his feeds off penetration. Felton finished with 12 points and 10 assists.

“The way we run the offense, the way Raymond gets in the paint and Pablo [Prigioni], it opens up a lot of things. If they want to help [on the point guard], it’s up to me to make that shot.’’

One night after their disgrace in Philly when Jrue Holiday toasted them, the Knicks got burned by another young point guard in Teague, who got to the rim at will and had 27 points. The Knicks defense was poor and Amar’e Stoudemire, despite a lively 18 points, looked lost on a lot of defensive breakdowns, losing his man.

But the Knicks got a big break late even as Anthony started to cool. His opportunity was set up when Smith committed a moving pick on Felton with 22 seconds left, giving the Knicks the ball back after Melo had missed badly on an inside shot. Moments earlier he had thrown the ball away, trying to force a pass to Stoudemire.

Anthony also got a technical foul down the stretch after bumping with DeShawn Stevenson and getting poked in the eye. Melo slammed the ball down in anger and got flagged. Kyle Korver made the technical foul shot that put the Hawks by one point with 2:02 left.

“He got me three times on one play,’’ Anthony said. “He got me somewhere in the face.’’

The only shot that mattered was the final layup that capped his night of 3-point madness.

“It’s a matter of taking those shots and making them,’’ Anthony said. “I now I’m capable of making them. When I’m making them from the perimeter, it opens up the game much more for myself.’’