Scottish League Cup holders Celtic are at home to Dunfermline in the last 16, while Rangers face a trip to East Fife.
Last season’s runners-up Aberdeen have been drawn away to Dundee.
There are two all-Premiership ties, with Motherwell taking on Hearts at Fir Park and Kilmarnock meeting Hamilton Accies at Rugby Park.
Hibernian are at home to Morton, with Ross County travelling to Partick Thistle and Forfar Athletic welcome Livingston to Station Park.
Scottish League Cup second round draw
Ties to be played on 17 and 18 August.
- Hibernian v Morton
- Partick Thistle v Ross County
- Motherwell v Hearts
- Dundee v Aberdeen
- Celtic v Dunfermline
- Forfar v Livingston
- Kilmarnock v Hamilton
- East Fife v Rangers
League One duo East Fife and Forfar are rewarded with home games after coming through the group phase.
Forfar stunned St Johnstone 2-1 on Saturday to seal their place as one of the four best runners-up, while East Fife beat Championship favourites Dundee United and earned a penalty shoot-out bonus point from their 1-1 draw with Hearts after opening the competition with a defeat at League Two Cowdenbeath.
The Methil side’s place in the draw was confirmed after Dundee’s 1-0 victory over Inverness CT on Sunday.
“At the start of the day we wanted to be in the draw, regardless of how we got there, and secondly we would have loved a home tie,” said Dens Park boss James McPake.
“I’ve played against Aberdeen here in the Scottish Cup – it was great atmosphere, they’ll bring a big crowd down, we’ll have a big home crowd, so it’s been a good day.”
Partick Thistle, who topped their section ahead of top flight Hamilton, failed to beat Ross County in four attempts last season but striker Kenny Miller is looking forward to the Firhill tie.
“They were champions of the Championship last year for a reason, they were the most consistent team across the season,” he said. “They have started the League Cup with four wins out of four, scoring goals, not conceding many.
“But we’re progressing nicely and it’s a good for us to be at home. The manager will know their strengths and weaknesses. We’ll be fully prepared.”
Celtic, Rangers, Aberdeen and Kilmarnock join at the knockout stage as Scotland’s European representatives this season, although the Ayrshire side have already been eliminated from Europa League qualifying.