Draw brings City rivals together
Hearts will host Hibs in the next round of the Scottish Cup, while Brechin City travel to Glasgow to face holders Celtic.
It is the third consecutive season that Hearts have met Hibs at Tynecastle in the tournament, with Hibs winning the past two ties in replays at Easter Road.
There will be a Lanarkshire derby between Motherwell and Hamilton Academical as Premiership teams enter the competition.
Two non-league teams will face each other and hope for lucrative tie in the fifth round.
Scottish Cup fourth round draw
Dunfermline Athletic v Greenock Morton
Ayr United v Arbroath
Albion Rovers v St Johnstone
Motherwell v Hamilton Academical
Heart of Midlothian v Hibernian
Livingston v Falkirk
Dundee v Inverness Caledonian Thistle
Formartine United v Cove Rangers
Montrose or Queen of the South v Partick Thistle
Celtic v Brechin City
Peterhead v Dumbarton
East Fife v Brora Rangers
Alloa Athletic v Dundee United
Fraserburgh v Rangers
Aberdeen v St Mirren
Kilmarnock v Ross County
Ties to be played on 20 and 21 January