An uncharacteristic mistake by Aberdeen goalkeeper Joe Lewis handed St Mirren a 2-1 victory and a place in the quarter-finals of the Betfred Cup.
A fiercely-contested encounter looked to be heading into extra-time until Lewis' howler on 88 minutes.
Jamie McGrath unleashed a shot from 22 yards straight at the experienced goalkeeper, who attempted to parry the ball down but it calamitously slipped between his own legs and he was unable to claw it off the line.
St Mirren deserved the victory after an excellent first-half performance where they grabbed an early lead courtesy of Ilkay Durmus' stunning free-kick on four minutes. After Dylan Connolly was fouled by Jonny Hayes, Durmus - making his return from injury - fired left-footed past Lewis into the bottom corner from 20 yards out.
The Buddies have struggled for goals this season but pushed forward relentlessly early on and almost doubled their advantage on eight minutes. Richard Tait was afforded the freedom to drive forward and the left-back crashed a low shot past Lewis but it struck the post and bounced to safety.
After an eventful opening 10 minutes, Aberdeen established a foothold in the game although they badly lacked the drive provided by the missing midfield duo of Ross McCrorie and Lewis Ferguson.
Despite Aberdeen's slight improvement, the hosts remained comfortable and had a strong shout for a penalty on 28 minutes. Tommie Hoban was manhandling Jonathan Obika as he attempted to reach a cross but referee Don Robertson was not interested and waved play on.
The impressive Connolly was a constant threat and he forced Lewis into a smart save after the Irishman displayed excellent skill to burst through defenders on 38 minutes. Minutes later, Obika somehow squandered an easy chance from four yards out, dragging the ball wide, and it proved to be costly.
Aberdeen had offered nothing as an attacking threat until they scored an equaliser on 42 minutes. The goal came in fortuitous fashion after Jonny Hayes' strike deflected into the path of Niall McGinn to poke past the advancing Jak Alnwick.
Derek McInnes made two changes at the interval and Aberdeen immediately went close when Ryan Hedges found Hoban unmarked from a corner but the 26 year-old headed wide when he should have scored.
Aberdeen appealed strongly for two penalties for handball around the 80th minute but those appeals were more in hope than expectation.
Substitute Junior Morias almost won it for the hosts in the 85th minute but Lewis made a smart stop low to his right before his late mistake.
Hibs edge past Dundee
Jamie Murphy's first-half strike was enough to send Hibernian into the quarter-finals of the Betfred Cup at Dundee's expense.
The Scotland international fired a low drive from inside the box past Jack Hamilton just seconds before the break, securing Hibs a 1-0 win.
That effort was enough to hand Jack Ross' side their second victory over the Dens Park side in the competition after Hibs won 4-1 in the last group game 13 days earlier.
Alloa shock Hearts
An Alan Trouten penalty in the second period of extra-time catapulted Alloa to a shock victory over Hearts.
The Wasps were well beaten by the Tynecastle side in the Championship in midweek but recovered to pull off their first competitive victory over the Jambos and book their place in the quarter-finals.
Hearts were well on top for most of the game against a side with just one point in five league games this season.
But Robbie Neilson's side lacked a cutting edge in attack and were made to pay 19 minutes into extra-time when Trouten converted after Jamie Walker hacked down substitute Robert Thomson.
Livingston thrash Ayr
Livingston reached the last eight in emphatic style, thrashing Ayr United 4-0 at the Tony Macaroni Arena.
In their first game since the departure of boss Gary Holt, the hosts made a quick start as Joe Chalmers' own goal and Jack Fitzwater's quick-fire double gave them a 3-0 lead inside 12 minutes.
Alan Forrest added a fourth for Livi, who were under the interim charge of David Martindale and Tony Caig, just before half-time as they reached the last eight of the tournament for the third time in four seasons.
St Johnstone stun Motherwell
Michael O'Halloran set up two goals as St Johnstone came from behind to beat Motherwell 2-1 and reach the Betfred Cup quarter-finals.
Tony Watt gave Motherwell the lead in the 61st minute following a set-piece but Saints turned the tie around inside 16 minutes at Fir Park.
Callum Hendry and David Wotherspoon both netted from close range after O'Halloran had charged to the bye-line and delivered low crosses.
With Danny McNamara absent, O'Halloran caused trouble for Motherwell all day from his wing-back position.
The victory extended St Johnstone's unbeaten run to 10 matches.
Dunfermline book quarter-final spot
Dunfermline booked their spot in the Betfred Cup quarter-finals with a routine 3-1 victory at Scottish Championship rivals Arbroath.
Ryan Dow gave the Championship leaders a 28th-minute lead with a fine solo goal. Collecting the ball on halfway, the midfielder drove forward before slamming into the top corner.
Euan Murray doubled the lead eight minutes later by slotting home from Dominic Thomas' floated corner although Dunfermline were pegged back when Dale Hilson drilled beyond Owain Fon Williams midway through the second half.
But after Arbroath defender Ricky Little was adjudged to have handled in the area, Kevin O'Hara scored the resultant penalty eight minutes from time as Dunfermline maintained their unbeaten start to the season in all competitions.
The quarter-final draw takes place on Sunday.