Stephen O'Donnell scored the winning penalty as Motherwell scraped past Morton in the Scottish Cup moments after the right-back appeared to have won the game in extra-time.
The right-back opened the scoring from 25 yards seven seconds from the 120-minute mark but the visitors levelled in stoppage-time when Markus Fjortoft headed home unchallenged from a corner.
Liam Kelly produced the only save of the shoot-out to deny Sean McGinty and O'Donnell kept his nerve to seal it 5-3 days after signing a new contract.
Morton had the best of the scarce chances in normal time before the game came to life in extra-time and Motherwell booked a trip to face Stranraer or Hibernian in the quarter-finals.
The Greenock side have only recorded two wins in 16 Championship games and are sitting in the relegation play-off zone but interim manager Gus MacPherson had guided them past Dunfermline and East Fife and into the last 16.
The former St Mirren boss enjoyed three cup wins against Motherwell during his Paisley days including a Scottish Cup triumph as a First Division side and his side more than held their own in the opening stages.
Robbie Muirhead and Aidan Nesbitt linked up well on several occasions and Morton had by far the best chance of the half.
Motherwell midfielder Robbie Crawford lost possession for the third time in quick succession and Reece Lyon skipped past a defender to go one on one with Kelly. The goalkeeper came out quickly to block the shot.
The home side began to force their visitors back in the latter stages of the half and had some dominant spells of possession after the break but had little to show for it. Christopher Long had a couple of ambitious long-range efforts saved and Devante Cole turned and fired off target.
Morton came close when right-back Michael Ledger steered a driven cross first time towards goal. Kelly was grateful the effort was straight at him.
Well boss Graham Alexander made his first change in the 81st minute, bringing on winger Jake Hastie for midfielder Barry Maguire. It was seven minutes into extra-time before it bore fruit, Hastie running at the heart of the Morton defence and setting up Long, who took a touch and hit the near post from a glorious chance.
Hastie got a chance himself from Allan Campbell's through ball but Fjortoft got back well to put the wide player off as he scuffed a shot wide.
The game burst to life late in the second period. Lewis Strapp could not direct his header on target after beating Kelly to Craig McGuffie's cross before Motherwell had a penalty claim denied when McGinty appeared to clip Hastie's heels.
Aidan McAdams pulled off a great stop from a Steven Lawless header before O'Donnell fired into the bottom corner from 25 yards and Fjortoft stunned the hosts.
No Data Analysis info