Scott Wilson scored the crucial penalty to prevent Dunfermline Athletic being humbled in the CIS Cup by Ayr United.
Debutant Dorus De Vries was the Pars' hero when he saved Ryan Caddis' penalty just before the end of 90 minutes.
And, when Craig Pettigrew missed in the shoot-out, defender Wilson stepped up to ensure the SPL side's progress.
Chris Strain had sent an effort against the crossbar and David Lowing fired just wide as the Second Division part-timers came close to a shock.
Ayr forward Jerome Vareille had given Ray Logan a sight on goal early in the game, but De Vries easily held the low drive from the edge of the box.
Dunfermline defender Souleymane Bamba almost opened the scoring in the 20th minute, but his 18-yard drive was narrowly wide of the right-hand post.
Calum Woods got down the left to cross deep into the six-yard area, but Andy Tod's header was straight at Ayr goalkeeper Mark McGeown.
De Vries was called on in the 65th minute when Bamba could not halt Vareille's break through the middle and the goalkeeper punched the ball away some 16 yards from his goal-line.
The clearance fell for Ayr striker Strain, but he lashed his effort on to the crossbar.
Dunfermline appeared to be doomed in the 86th minute, when Bamba fouled Gareth Wardlaw and referee Craig Thomson pointed to the spot.
However, Caddis saw De Vries parry the shot before the ball was blasted clear.
Bamba again fouled Wardlaw - this time 25 yards from goal - but Lowing sent his free-kick inches over as the game moved into a penalty shoot-out.
However, after the teams could not be divided at 6-6 in the shoot-out, Pettigrew fired past the post before Wilson sealed the win for last season's runners-up.
Ayr: McGeown, Forrest, Campbell (Pettigrew 50), Robertson, Lowing, Strain (Dunn 91), Casey, Logan (Wardlaw 72), Weaver, Caddis, Vareille.
Subs Not Used: Friels, Johnson.
Dunfermline: De Vries, Scott Wilson, McGuire, Bamba, Ross (Craig Wilson 70), Mason, Young, McCunnie (Smith 65), Woods, Tod, Owen Morrison.
Subs Not Used: Campbell, Phinn, McKenzie.
Booked: McCunnie, De Vries, Bamba, Woods.
Ref: C Thomson