Former Aberdeen and Scotland legend Willie Miller conducted the draw alongside BBC Scotland presenter Amy Irons, following the televised match between Brechin City and Darvel on Monday night.
The Light Blues will host League Two side Stirling Albion at Ibrox, while the Hoops head for Clackmannanshire to face League One outfit Alloa Athletic, managed by Gers icon Barry Ferguson.
Jim Goodwin’s St Mirren face a tricky trip to play Ayr United at Somerset Park, while Championship high-flyers Partick Thistle will entertain Airdrieonians at Firhill Stadium.
Giant killers Auchinleck Talbot and Clydebank, who knocked out Hamilton Accies and Clyde in the previous round, were both rewarded with home ties against Hearts and Annan Athletic respectively.
Scottish Cup fourth round draw in full:
Peterhead Vs East Kilbride
Clydebank Vs Annan Athletic
Banks O’ Dee Vs Raith Rovers
Motherwell Vs Inverness or Morton
Kelty Hearts or Montrose Vs St Johnstone
Livingston Vs Ross County
Dumbarton Vs Dundee
Aberdeen Vs Edinburgh City
RANGERS Vs Stirling Albion
Ayr United Vs ST MIRREN
Kilmarnock Vs Dundee United
Hibernian Vs Cove Rangers or Queen of the South
PARTICK THISTLE Vs Airdrieonians
Auchinleck Talbot Vs Hearts
Alloa Athletic Vs CELTIC
Arbroath Vs Brechin City or Darvel
*Ties will be played on the weekend of 22 January 2022.