Scottish Cup holders Celtic will face Partick Thistle in a Glasgow derby in the fifth round of the tournament.
The Bhoys comfortably defeated Brechin City 5-0 in the previous round to set up a home clash against Thistle, who qualified for the fifth round after beating Queen of the South 2-1 at Palmerston Park.
Old Firm rivals Rangers will face League One side Ayr United in the fifth round if they defeat Football League club Fraserburgh on January 31.
Hearts have been rewarded with a home tie match against Albion Rovers or St Johnstone after defeating rivals Hibernian 1-0 in the Edinburgh derby on Sunday afternoon.
Last season’s runners-up Aberdeen will face New Firm rivals Dundee United at Pittodrie, while Dundee will take on either Inverness or Motherwell.
The lowest ranked side left in the competition, Brora Rangers, travel to face Kilmarnock after beating Stranraer.
Meanwhile, Highland League sides Formartine United and Cove Rangers will battle it out in the fourth round to face either Livingston or Falkirk.
All fifth round matches are due to be played on the weekend of February 10-11.