Holders Celtic will play host to Aberdeen in the fifth round of the Scottish Cup.
As a result, Neil Lennon's men missed out on an Old Firm derby with Glasgow rivals Rangers, who will take on either Ayr United or Dunfermline.
Meanwhile, Albion Rovers, who knocked out Motherwell in the previous round, will face Stenhousemuir at home.
The draw in full:
Alloa Athletic vs. Dumbarton Clyde or Stranraer vs. Inverness Caledonian Thistle Hibernian vs. Raith Rovers Albion Rovers vs. Stenhousemuir Brechin City or Forfar Athletic vs. St Johnstone Celtic vs. Aberdeen Dundee United vs. Queen of the South or St Mirren Rangers vs. Ayr United or Dunfermline Athletic
The ties will be played on the weekend of February 8.