With Dunfermline already one goal up Rangers' miserable season looked set to plumb new depths when captain for the day Michael Mols was sent off on his last appearance for the club.
What happened next was barely believable as Mols' fellow Dutchman Fernando Ricksen equalised with a right-foot thunderbolt before highly promising winger Chris Burke made it 2-1 with an impudent left-foot chip.
Ross McCormack's second-half penalty extended Rangers' advantage and even though Gary Dempsey soon trimmed the deficit, the Pars could not avoid only their third home defeat of the season just six days before they face Celtic in the Scottish Cup Final.
An afternoon of goals was clearly in the offing from the very start with Burke and Dempsey both going close in the first 12 minutes. Strikers Stevie Crawford and Craig Brewster were combining as effectively as ever for Dunfermline, although Crawford for once lacked the composure to add to his 17 goals this term.
Dempsey had no such problems in the 27th minute when his quickly taken free-kick left young Rangers keeper Allan McGregor stranded as he continued to organise his defensive wall.
Mols and Ricksen complained bitterly to referee Alan Freeland, but the goal stood. Mols however would not let it go despite being booked for his protest and after a warning for an off the ball challenge, he was red-carded for a reckless tackle on Dempsey.
Rangers looked in total disarray yet they were in front by half-time and withstood fierce home pressure at the start of the second period with Brewster, Barry Nicholson and Crawford all threatening to pull the Fifers level.
Nicholson then fouled debutant striker McCormack inside the penalty box and the youngster became an instant Rangers hero by calmly slotting home this spot-kick.
A second Dempsey free-kick again left McGregor with questions to answer and gave Dunfermline fresh hope, but the equaliser would not come.
Paolo Vanoli and Stephen Hughes both survived strong penalty claims after apparently handling and in injury time McGregor redeemed himself with a crucial save to deny Dempsey.