In the end, it was a mistake that sent Rangers through to the semi-finals when goalkeeper Marco Ruitenbeek bundled a header from second-half substitute Claudio Caniggia over his goalline to the relief of the vast away support.
Like their Glasgow rivals the previous night, the Light Blues may consider themselves fortunate to have progressed through to the last four but McLeish will no doubt accept the result regardless.
The draw paired Rangers with either Aberdeen or Hearts, setting up the prospect of an Old Firm final next March.
Such an outcome had looked unlikely in the early stages of the second half when Dunfermline carved out at least three goal-scoring chances but failed to convert any.
Rangers’ survived a penalty scare when Arthur Numan collided with Barry Nicholson in the penalty box but Dunfermline’s appeals were in vain as ref Dougie McDonald waved play on.
Craig Brewster was the main protagonist in his side’s best two chances of the half, getting in the way of Barry Nicholson’s net-bound drive and then watching in astonishment as Stefan Klos somehow parried his stinging volley from 12 yards.
Four minutes later and Rangers were ahead. There seemed little danger when Mikel Arteta fired in a free-kick from wide on the right but Caniggia’s header trickled over the line via the hand of Ruitenbeek.
Pars boss Jimmy Calderwood launched his traditional response to a losing situation, switching to a 2-4-4 formation and pinning in Rangers in search of an equalising goal.
Such excitement was in great contrast to a turgid opening half notable only for three bookings and an Arteta drive that was well blocked by Ruitenbeek.
Michael Mols also looked to continue his rich run of form but he too was denied a goal when his compatriot Ruitenbeek cleared his stinging shot with his legs.
In a spirited second-half showing, it looked as if Dunfermline would finally end their 14 year winless spell over Rangers – until Caniggia came on to turn the game and send his side through to the last four.
Dunfermline (3-5-2): Ruitenbeek; McPherson (Kilgannon 81), Skerla, Wilson; Bullen, Nicholson, Mason (Hampshire 85), Dempsey, Dair; Crawford, Brewster
Subs not used: Stillie, Karnebeek, Walker,
Booked: Brewster, Dempsey, McPherson, Nicholson
Rangers (3-5-2) : Klos, Ross, Malcolm, Konterman; Hughes, Ricksen, Ferguson, Arteta, Hughes (Arveladze 56); Mols (Caniggia 70), Lovenkrands
Subs not used: Muscat, Latapy, McGregor
Booked: Hughes, Ross
Referee: Dougie McDonald
Attendance: 8415
Man of the Match: Stefan Klos