Benji Siegrist broke Ayr hearts with a string of super stops - before coming up trumps on penalties for Dundee United.
The giant stopper kept his side in the game as The Honest Men went for the kill against their Premiership rivals after half time.
And after Siegrist's heorics, the Arabs snuck back into the contest through a hotly disputed penalty which saw Jack Baird ordered off - and left Ayr boss David Hopkin fuming.
But ten man United limped on to spot kicks, before Siegrist denied Paddy Reading and Jonathan Afolabi to send the Tangerines through.

Hopkin had made four changes from the team which drew with Arbroath last week as he sought a fresh approach.
Aidan McAdams returned between the sticks to make his first start since the opening game of the season at Albion Rovers.
Also in from the start were Aaron Muirhead, Michael Hewitt and Mark McKenzie, with Muirhead handed the captain's armband in place of Sean McGinty, who was one of four who dropped to the bench.

And after a tight opening to the game, it was Ayr who fashioned the best early opening through their most creative option.
Reading did well to intercept the ball down the left and played in James Maxwell but his effort crashed off the sidenetting when he should have worked Siegrist.
That lifted home spirits and Ayr sniffed they were well in the contest.

And they almost hit the front on the half hour when Tomi Adeloye produced a great take on his chest before lashing the ball just wide.
The visitors were rattled for a spell but they threatened just before the break as Nicky Clark slipped in Peter Pawlett but McAdams was out to save at his feet.
The Arabs came out after the restart looking to force the pace but they lacked creativity and Ayr should have been in front with a golden chance.
Adeloye did well to hold up the ball and lay off for Hewitt on the right and his cross was met flush on the volley 12 yards out by Maxwell but it flew straight at Siegrist who parried the ball over.

Andy Murdoch was next up to try his luck as he robbed possession at the edge of the box and under the challenge of Ian Harkes, he pulled a shot just wide.
But Ayr's pressure would pay off as they hit the front owing to more great pressing - this time from McKenzie - and when the ball broke to Adeloye he knocked the ball home at the second attempt after a smart initial save from Siegrist.
Ayr were rampant at this stage and they should have doubled the lead when Adeloye played in Maxwell but he shot over instead of playing the striker back in with a tap in waiting.
Reading then saw a fizzing effort from 25 yards denied by Siegrist at full stretch as Ayr looked to put the tie to bed.

But Ayr's lead was fragile and Harkes almost levelled out of nothing for the Arabs as his close range shot was brilliantly blocked by Reading.
At the other end, Siegrist pulled off a stunning stop to push a McKenzie shot on to the bar after Adeloye had done brilliantly to tee him up as Ayr missed another chance to bury the tie.
But the misses would come back to haunt Ayr as with ten minutes to go, ref Nick Walsh threw the game into the melting pot by handing Dundee United a disputed penalty.
Baird was given his marching orders for a second yellow card after being judged to have pulled Ryan Edwards in the box and Clark stepped up to ram home the spot kick and sicken the hosts.

Ayr held on to extra time but they got a real escape when a well worked free kick saw Charlie Mulgrew and Pawlett combine to play in sub Mark McNulty, but he shelled the ball over from close range.
Then ex-Ayr man Liam Smith worked space 25 yards out to rattle the post with a wonderful effort which had McAdams beaten before the keeper did well to deny Clark moments later.
And Ayr could dramatically have won it as the clock ticked down towards penalties when sub Joe Chalmers dragged his shot wide from the edge of the box.
That sent the tie to spot kicks with Reading and Afolabi missing for Ayr, while Muirhead, Sean McGinty and Nick McAllister all scored but it wasn't enough as they went down 4-3.
Don't miss the latest Ayrshire headlines – sign up to our free daily newsletter here