Rocky Bushiri's late glancing header secured Hibernian's spot in the Scottish Cup quarter-finals as they overcame stubborn Ayr United at Somerset Park to stretch their unbeaten run to 11 games.
Ayr looked set to take the Premiership visitors to extra time, but Bushiri dived to meet a flick-on from substitute Kieron Bowie and send Hibs through.
Both sides came into the tie in stellar form, with Ayr leading the Championship and undefeated in eight, and it was the hosts who came closest early on.
The in-form George Oakley raced through but failed to poke his shot past Jordan Smith before Martin Boyle spurned a chance for the visitors, with his effort claimed by Harry Stone.
Oakley was almost in one-on-one again but was prevented by a well-timed Jack Iredale challenge.
Hibs started to gain some control and Josh Campbell had a well-struck shot saved before Iredale's deep cross was headed into the ground and on to the roof of the net by Boyle.
Mykoka Kuharevich and Campbell had second-half shots blocked, while a smart flick led to Connor McLennan volleying on target for Ayr as both sides probed for a goal.
As extra time beckoned, Hibs ramped up the pressure and Boyle slid a glaring chance past the far post before Burishiri made the 87th-minute breakthrough.
Hibs still had work to do, with goalkeeper Smith pulling off a sensational double save from Jamie Murphy to preserve his side's slender advantage.