Having comfortably disposed of Clydebank and Albion Rovers in the previous rounds, it was the turn of Gordon Dalziel’s Honest Men to stand between Jim Jefferies’ side and a place in the semi-finals.
The match took place 23 years ago this month, and Hearts went into the encounter full of confidence on the back of a nine-game unbeaten run which included a 2-2 draw at Ibrox the previous week.
And they made a strong start against the First Division side as goals from Paul Ritchie and Thomas Flogel had the hosts two goals up inside 17 minutes, only for Ian Ferguson to pull one back for the visitors two minutes later.
Ayr’s hopes of mounting an unlikely comeback were hampered by a red card for Derek Anderson just before the half hour for aiming a kick at Jim Hamilton, and second half strikes from Stevie Fulton and Hamilton ensured a comfortable 4-1 win over the 10 men.
Hearts famously went on to win the Scottish Cup that year, defeating Rangers 2-1 in the final at Parkhead, after accounting for Falkirk 3-1 in the semi-final at Ibrox.
But what about the 14 players who played their part in the win over Ayr? All but four of them would go on to feature in the final ...
. 07/03/98 TENNENT'S SCOTTISH CUP QUARTER-FINAL
HEARTS v AYR UTD (4-1)
TYNECASTLE - EDINBURGH
Paul Ritchie is congratulated by Neil McCann (left), Jim Hamilton and Steve Fulton after giving Hearts a 1-0 lead.
Paul Ritchie is congratulated by Neil McCann (left), Jim Hamilton and Steve Fulton after giving Hearts a 1-0 lead against Ayr United in the 1998 Scottish Cup quarter-final. Photo: SNS Group
. Gilles Rousset
The twice-capped French goalkeeper went on to play a man of the match role in the '98 final. He is currently an assistant coach in China with Beijing Sinobo Guoan. Photo: SNS Group
. Gary Locke
The club captain was cruelly robbed of his place in the cup final by injury. Went on to manage Hearts, Kilmarnock, Raith and Cowdenbeath but is now back at Tynecastle in a club ambassador role. Photo: SNS Group
. Gary Naysmith
The youngest player in the 1998 team, Naysmith was appointed Edinburgh City manager this week. Has previously managed East Fife and Queen of the South, and also had a spell back at Hearts as loans manager. Photo: SNS Group
1. Gilles Rousset
The twice-capped French goalkeeper went on to play a man of the match role in the '98 final. He is currently an assistant coach in China with Beijing Sinobo Guoan. Photo: SNS Group
2. Gary Locke
The club captain was cruelly robbed of his place in the cup final by injury. Went on to manage Hearts, Kilmarnock, Raith and Cowdenbeath but is now back at Tynecastle in a club ambassador role. Photo: SNS Group
3. Gary Naysmith
The youngest player in the 1998 team, Naysmith was appointed Edinburgh City manager this week. Has previously managed East Fife and Queen of the South, and also had a spell back at Hearts as loans manager. Photo: SNS Group
4. David Weir
The former Scotland centre-half was previously assistant to Mark Warburton at Rangers and Nottingham Forest but is currently with Brighton & Hove Albion working as a liaison manager for loan players based abroad. Photo: SNS Group