Kevin Ellison's last-minute winner against his old club earned Morecambe victory over 10-man Rotherham United.
Left-back Robbie Threlfall fired the Shrimps ahead with a superb free-kick into the bottom corner on 56 minutes.
Alex Revell then deflected home a Lionel Ainsworth shot to level eight minutes later, before the Millers had skipper Johnny Mullins sent off for fouling Andy Wright.
Ellison then won it in with a looping header from Wright's right-wing cross.
Morecambe's victory, a response to the Easter Monday defeat by Wycombe which boss Jim Bentley described as the worst display since he was appointed manager, all but secures safety.
It moves them nine points clear of danger with just three games left and a vastly superior goal difference to the teams most under threat.
Rotherham, in sixth, are now four points shy of an automatic League Two promotion place.
VIEWS FROM THE DRESSING ROOM
Morecambe manager Jim Bentley told BBC Radio Lancashire:
"It's difficult when you don't win games and we haven't been in the best of form recently.
"I asked the lads for a response and they showed the type of lads that they are.
"Wycombe was one of those days when nothing went right but they gave me a response.
"If we'd have come off after 88 minutes with a 1-1 draw, I would have been pleased. I can't compliment the lads enough."
Rotherham United manager Steve Evans tells BBC Radio Sheffield:
"What about their red card and the penalty we don't get, but we get it every week now don't we?
"The red card Johnny (Mullins) says he gets a touch on the ball. I need to have a look at it, but it's hard to take.
"Even with 10 men we're battering them but we go away pointless.
"It's the biggest blatant penalty we've seen... and we don't get it."