The draw for the cup was made at Easter Road after the Edinburgh derby
Falkirk will face Hearts at Tynecastle in the fifth round of the Scottish Cup, and Dundee United, victors over East Stirlingshire, will travel to Hamilton.
Forfar are rewarded for their win over Forres Mechanics with a home tie against Rangers while Peterhead or Queen's Park will head to Celtic Park.
Aberdeen host East Fife and Airdrie United take on Dunfermline.
After drawing on Saturday, the winner of the Ayr United and Kilmarnock replay will head north to play Inverness.
Scottish FA President George Peat, Justice Secretary Kenny MacAskill and former Hibernian star Pat Stanton made the draw at Easter Road on Sunday afternoon after Hibs had lost 2-0 to rivals Hearts.
If Motherwell overcome Inverurie Locos and St Mirren defeat Brechin City, the Scottish Cup will have another tie featuring sides from the top league.
Manager Neale Cooper insists his Peterhead players could not have asked for a bigger incentive to overcome Queen's Park after being drawn against Celtic.
Both teams battled out a 2-2 draw at Balmoor and Peterhead now face a difficult away tie in the replay but Cooper is even more determined to progress now.
"It's a fantastic draw for either team," he said.
"You either hope you get a tie at home against a team you can beat or - as all directors and chairmen would want - a game against Celtic or Rangers away.
"It's unbelievable. Obviously we have a difficult game against Queen's Park first and hopefully they have a difficult game against us.
"In any game, both teams will show the right attitude.
"But to know that is the carrot for either side is a massive incentive."
HOMECOMING SCOTTISH CUP FIFTH ROUND DRAW
Forfar Athletic v Rangers
Airdrie United v Dunfermline Athletic
Heart of Midlothian v Falkirk
Inverurie Locos or Motherwell v St Mirren
Aberdeen v East Fife
Celtic v Queen's Park
Hamilton Academical v Dundee United
Inverness Caledonian Thistle v Ayr United or Kilmarnock
Ties to be played on the weekend of 7/8 February 2009.
This page is best viewed in an up-to-date web browser with style sheets (CSS) enabled. While you will be able to view the content of this page in your current browser, you will not be able to get the full visual experience. Please consider upgrading your browser software or enabling style sheets (CSS) if you are able to do so.