Hearts topped the group despite being held to a 1-1 draw at East Fife, who won the shoot-out. The League 1 side will qualify as one of the best runners-up if there is a winner in Sunday's Dundee v Inverness CT game. Stenhousemuir beat Cowdenbeath 2-0 at Ochilview in the other game.
Ross County had already sealed first place and will be joined in the last 16 by Forfar Athletic, who shocked St Johnstone 2-1 at Station Park. Brechin City and Montrose drew 1-1 at Glebe Park, with the visitors winning the shoot-out.
Hibernian beat Elgin City 2-0 on Friday night to win the group. Arbroath would have gone through in second place with a win but lost 3-2 at home to Alloa Athletic.
Dundee and Inverness CT meet at Dens Park on a Sunday and a draw would send both through. Cove Rangers saw off Raith Rovers 3-0 at the Balmoral Stadium.
Motherwell beat Annan Athletic 4-0 at Fir Park to maintain their 100% record and Morton became the first runner-up to qualify with eight points - they drew 3-3 with Queen of the South at Cappielow then won the shoot-out.
Partick Thistle were already assured of first place. Hamilton Accies booked their last-16 spot after storming back to beat Airdrieonians 3-2 at the Penny Cars Stadium. Queen's Park play Clyde on Sunday.
Livingston thumped Berwick Rangers 5-0 at the Tony Macaroni Arena to win the group but Ayr United missed the chance to join them in the next round after a 2-2 draw with Stranraer, who won the shoot-out at Somerset Park.
Dunfermline Athletic defeated East Kilbride 4-0 at East End Park to finish top and Albion Rovers were second after a 2-1 home win over Edinburgh City.
The draw for the last 16 takes place on Sunday, live on BT Sport after Dundee v Inverness CT, kick-off 3.00pm. Ties will be played on the weekend of August 17/18.
Heart of Midlothian
Plus two of:
Inverness Caledonian Thistle