BOSTON — Derek Stepan was crumpled on the ice in pain with what later was diagnosed as broken ribs, after taking a late hit from Matt Beleskey that sent the Rangers center into the wall from a couple of feet away 8:06 into the second period on Friday afternoon.

From a few feet away, Dylan McIlrath had no doubt an immediate response was required. And he was correct, even if he picked up a two-minute instigator penalty (plus five for fighting and a corresponding 10-minute misconduct) for pummeling the Bruins’ winger.

McIlrath was correct, even if that instigator penalty gave the Bruins a power play (on which they scored the tying goal to make it a 2-2 game) when the Wes McCauley-Chris Rooney refereeing duo somehow failed to assess Beleskey for boarding on the dangerous play that merits review and imposition of supplementary discipline from the NHL Department of Player Safety.

“Seeing Step down on a hit like that, I think it’s important to step up for a teammate,” the rookie defenseman told The Post after the Blueshirts lost 4-3 by yielding a pair of goals 2:03 apart within the final 3:46 of the third period.

“Obviously I don’t want to take the penalty, but I can’t allow the instigator to stop me.”

Truer words were never spoken. Perhaps coincidence, perhaps not, the Rangers played with as much jam as they have all season with McIlrath — who had rocked Landon Ferraro into the left wing boards on a rush 7:00 into the first on the team’s most notable check of the campaign — in the lineup for just the fifth time this season.

McIlrath said he had received the endorsement of his teammates during the second intermission. That’s comforting, as the Rangers have absorbed more than their share of abuse not only this season, but through the years.

Enough is enough, just as it is enough of Alain Vigneault — understandably upset at the hit — keeping McIlrath in street clothes so the coach can get another finesse-alleged puck mover in the person of Dan Boyle into the Blueshirts’ homogenous lineup.

“All the guys said they appreciated it; Step, too,” said McIlrath, who played a total of 10:04. “It’s unfortunate that they scored on that power play, but it is what it is.”

Again, correct. It was unfortunate the Rangers couldn’t kill it off, just as it was unfortunate the Blueshirts couldn’t protect a 3-2 lead by killing off a holding penalty assessed to Jesper Fast at 14:54 of the third, and just as it was unfortunate they broke down soon after that under relentless pressure before David Krejci’s blast hit Emerson Etem’s stick and beat Henrik Lundqvist for the winner at 18:17.

“Absolutely, Dylan did the right thing,” Ryan McDonagh told The Post. “As far as the hit goes, Step is one of the smartest guys I’ve ever played with, he knows the situation when he’s on the ice, he knows how to take a hit, and for him to do down and get hurt on a play like that, there’s something off there.”

How often through their 16-3-2 getaway did the Rangers win games in which they had been off their game and literally had been saved by Lundqvist? That’s a rhetorical question, by the way.

Here, the Blueshirts played one of their sturdiest and most impressive matches. There were still too many defensive zone blunders, especially in front, but this was way better in so many ways.

The Beleskey-Stepan incident wasn’t the only questionable one in the match. Brad Marchand, cutting across the crease, got a piece of Lundqvist’s stick that hindered the netminder on Patrice Bergeron’s game-opening goal, but Vigneault did not challenge as the King was just outside the protected blue paint.

Marchand got Lundqvist again barreling across, this time up high, for which a goaltender’s interference penalty was called at 7:59 of the third, and for which the B’s paid when J.T. Miller — strong throughout — got a piece of Yandle’s point shot that ultimately caromed off the post and Tuukka Rask to give the Rangers a 3-2 lead at 9:28.

The Blueshirts could not protect it. And now they will be without Stepan for an indefinite length of time. Still, this day was not a total loss, for this was the day Dylan McIlrath made his presence known.

The Rangers need more of that.

They need more of McIlrath, too.