A four goal blast in extra time sent Hawick Legion rocketing into the second round of the Waddell Cup.
In what turned out to be a swashbuckling free scoring derby clash, Legion had the better of the opening exchanges.
Scott Duncan and Craig McCutcheon fired efforts past the target before Jamie Dickson forced Waverley keeper Kerr Brown into making a fine save after having cut in from the right flank.
Legion keeper Ewan Reilly then showed his mettle in pushing away a well struck Andrew McFarlane drive at full effort.
Minutes later Scott Craig almost put Waverley ahead in blasting a shot against the upright after latching on to a though ball from Neal McConnell.
With a minute of the first half remaining, Waverley broke the deadlock when Stuart Drysdale touched home a Luke Cooper corner kick from close range.
In the third minute of the second half, Waverley increased in their lead.
Jordan Yardley this time emerging the marksman in polishing off a good build up move with a spot on finish.
Waverley were looking good at this stage but in the 57th minute, Legion put themselves back in the picture through a well taken Duncan goal.
Five minutes later, Legion drew level. On being fed by a Callum Hope cross, former Waverley signing Liam Lavery fired into the net.
The action continued and with 79 minutes gone, Liam Gellaitry edged Waverley ahead with a rasping drive.
Legion began to push for an equaliser and with seconds of the match remaining achieved their aim.
Simon Philbin floated a corner kick high into a crowded goalmouth and in attempting to clear, Waverley defender Chris Dunne turned the ball into his own net.
The cup tie duly went into extra time and with four minutes of the first period gone, substitute Sean Owens put Legion in front.
This counter gave Legion a lift and Euan Gray stuck away a fifth just before the opening period ended.
Legion were now in the driving seat and Sean Solley put Waverley further into arrears in connecting with a Hope corner.
In the closing stages Owens completed the scoring.