One moment, the Rangers appeared on their way to being swept out of the playoffs by the Boston Bruins.

The next, Bruins goaltender Tuukka Rask stumbled and fell, literally, and the Rangers suddenly had new life.

The Rangers capitalized Rask’s miscue to battle back from a two-goal second period deficit and rallied again after falling behind in the third period to pull out a 4-3 overtime victory in Game 4 of the Eastern Conference semifinals at Madison Square Garden.

Chris Kreider scored the winner with 7:03 into the extra session as the Rangers avoided the series sweep and forced a Game 5 Saturday at TD Garden. Kreider drove to the net to chip a pass from Rick Nash over Rask’s right shoulder for his first goal of the playoffs.

It was the first time the Rangers won an overtime game in this year’s playoffs after they lost their first three, including a 3-2 defeat in Game 1 of this series.

The Rangers are trying to become just the fourth team in NHL history to come back from a 3-0 series deficit to win. The Bruins are the most recent team to blow a 3-0 lead, doing it against Philadelphia in the 2010 conference semifinals.

The way they let leads of 2-0 and 3-2 slip away Thursday night might get the Bruins wondering what they have to do to finish off the Rangers.

Facing elimination, Rangers coach John Tortorella decided to sit out struggling veteran center Brad Richards as a healthy scratch. It was not a complete surprise as Richards has just one goal and no assists in 10 playoff games this year after struggling for much of the regular season.