Holders Celtic face a trip to either Inverness Caledonian Thistle or Dunfermline in round five of the FA Cup.
Elsewhere, Celtic's Glasgow rivals Rangers will welcome Dundee United to Ibrox for a place in the quarter-finals.
The draw in full:
Hibernian vs. Dundee or Kilmarnock
Motherwell vs. Greenock Morton
St Mirren or Hamilton vs. Ross County
Inverness or Dunfermline vs. Celtic
Ayr vs. Falkirk
Rangers vs. Dundee United
Hearts vs. St Johnstone
Aberdeen vs. Queen of the South
Ties to be played in early February.