Cove Rangers will take on Rangers for the first time in their history in the Scottish Cup third round.
Paul Hartley’s League Two champions will travel to Ibrox in the final weekend of January.
Holders Celtic have been handed a home tie against Arbroath or Falkirk as they bid to win an unprecedented fifth Scottish Cup in a row and Hamilton will host St Mirren in the only all-Premiership tie.
Dundee have been handed a home Tayside derby against St Johnstone after scraping past non-league Bonnyrigg Rose on Saturday night.
James McPake’s side needed an equaliser from Jonathan Afolabi deep into stoppage-time to force extra-time at Dens Park, and they again came from behind to win 3-2.
With a number of games postponed over the weekend, the only other decided tie will see 2016 winners Hibernian travel to Dumfries to take on Queen of the South.
Ross County have been handed a home tie against either Highland rivals Inverness or Highland League side Buckie Thistle.
Dundee United will host Partick Thistle or Cowdenbeath while Aberdeen will either make the relatively short trip to Huntly or face a longer journey to Dumbarton.
Motherwell will either travel north to take on Fortmartine or south to face Annan while Livingston will host either Stirling or former manager John McGlynn’s Raith Rovers side.
Kilmarnock face a trip to either Peterhead or Stenhousemuir while Hearts, runners-up in the past two seasons, will face Stranraer at home if they can get past either Camelon or Brora Rangers, who have still to play their first-round game.
Scottish Cup Third Round Draw in full
Camelon or Brora Rangers or Heart of Midlothian v Stranraer
Celtic v Arbroath or Falkirk
Dumbarton or Huntly v Aberdeen
Dundee United v Partick Thistle or Cowdenbeath
Dundee v St Johnstone
East Fife v Greenock Morton or Dunfermline Athletic
Elgin City or Ayr United v Keith or Clyde
Forfar Athletic v Airdrieonians or Edinburgh City
Formartine United or Annan Athletic v Motherwell
Fraserburgh v Nairn County or Montrose
Hamilton Academical v St Mirren
Livingston v Stirling Albion or Raith Rovers
Peterhead or Stenhousemuir v Kilmarnock
Queen of the South v Hibernian
Rangers v Cove Rangers
Ross County v Buckie Thistle or Inverness Caledonian Thistle
Follow STV News on WhatsApp
Scan the QR code on your mobile device for all the latest news from around the country