Celtic face Motherwell in Scottish League Cup last 16
Celtic host Motherwell and Hearts travel to face St Johnstone in two all-Premiership ties in the last 16 of the Scottish League Cup.
League One sides Peterhead and Alloa Athletic face top-flight opposition - Rangers and Inverness CT respectively.
Premiership sides Aberdeen and Partick Thistle are away to Ayr United and Dundee United respectively.
Top-flight Hamilton host Greenock Morton, with Championship rivals Hibs and Queen of the South in opposition.
The ties are scheduled to be played on Tuesday, 9 August.
Sunday's draw followed the last of 80 group games, with United's 2-0 win over fellow Championship side Dunfermline Athletic confirming Ray McKinnon's side as runners-up in Group C.
McKinnon told BBC Scotland: "It is a home tie, which we were hoping for.
"It will be a difficult game. Partick Thistle are a good team and they are a league above us at the moment."
Peterhead's tie against Rangers is a repeat of last season's Petrofac Training Cup final, which the Ibrox side won 4-0 ahead of them winning the Championship title and promotion.
Jim McInally's side were surprise winners of Group A as Premiership side Dundee failed to qualify, as were Alloa in Group D ahead of holders Ross County, who failed to live up to their billing as top seeds in their section and also exited the competition.
Kilmarnock were the other top-flight side to fail to qualify from the eight sections as European representatives Aberdeen, Scottish champions Celtic, Hearts and Hibernian joined the competition after being given byes into the last 16.
Hearts, who finished third in the Premiership, will be involved in probably the tie of the round against St Johnstone, who finished fourth.
Alloa, Morton, Thistle and Rangers had joined the European quartet as seeds for the last-16 draw thanks to winning their groups with the highest number of points.
Scottish League Cup last 16 draw
Alloa Athletic v Inverness Caledonian Thistle
Ayr United v Aberdeen
Celtic v Motherwell
Dundee United v Partick Thistle
Hamilton Academical v Greenock Morton
Hibernian v Queen of the South
Rangers v Peterhead
St Johnstone v Heart of Midlothian
Ties to be played on Tuesday 9 August