Holders St Johnstone have been drawn away to Kelty Hearts or Montrose in the Scottish Cup fourth round.
Celtic, who have won the competition a record 40 times, are away to Alloa Athletic.
Rangers, who last won the trophy in 2009, will welcome League 2 Stirling Albion to Ibrox.
Ayrshire junior side Auchinleck Talbot are rewarded for their win over Hamilton Academical with a home draw against Hearts.
North Superleague outfit Banks O’Dee, who beat League 1 East Fife in the third round, have a home tie against Championship side Raith Rovers.
Auchinleck’s West of Scotland Premier Division rivals Clydebank take on Annan Athletic.
There is one all-Premiership tie between Livingston and Ross County.
All ties will be played over the weekend of Saturday, 22 January.
Scottish Cup fourth-round draw
Peterhead v East Kilbride
Clydebank v Annan Athletic
Banks O’Dee v Raith Rovers
Motherwell v Inverness CT or Morton
Kelty Hearts or Montrose v St Johnstone
Livingston v Ross County
Dumbarton v Dundee
Aberdeen v Edinburgh City
Rangers v Stirling Albion
Ayr United v St Mirren
Kilmarnock v Dundee United
Hibernian v Cove Rangers or Queen of the South
Partick Thistle v Airdrieonians
Auchinleck Talbot v Hearts
Alloa Athletic v Celtic
Arbroath v Brechin City or Darvel