Lawrence Shankland's stunning goal clinched a 2-0 win to help Ayr United beat Partick Thistle and win their League Cup section.
Thistle finish second in Group E, but will join Championship rivals Ayr in the last 16 should Hearts fail to beat Inverness Caledonian Thistle on Sunday.
Shankland's 45-yard strike added to Michael Moffat's early opener as Ayr made it four wins from four.
Michael Tidser scored twice as Morton beat Albion Rovers 5-0.
Bob McHugh, Connor Bell and Ben Armour also scored in the group's other game to leave the Ton in third place.
Thistle have nine points, which, as it stands, is enough to qualify as one of the four best runners-up. But a win for Hearts would mean they pip the Firhill men on goal difference.
The draw for the last 16 takes place following that match at Tynecastle, with fixtures to be played on 18 and 19 August.
- Kilmarnock & St Mirren both go through
- Motherwell fight back to beat Clyde & win group
- Livingston ease though, but Hamilton are out
- County beat Alloa to qualify, as Dundee Utd earn consolation win
- Dunfermline & Dundee progress to last 16
- St Johnstone edge out Forfar to win group