After looking down and out with 48 minutes gone Heriot's found hitherto unexplored reserves of determination and skill to hit back with four second half tries - by Cammy Goodall, Innes Brown, Oliver Brown and Jim Thompson - to briefly hint at one of the tournament's great comebacks.
Alas for the gallant Goldenacre side they had left themselves too much to do after a first half when the occasion seemed to overwhelm them not to mention some quality play from Melrose stand off Scott Wight, the man-of-the-match, and full back Jordan Macey.
Heriot's were caught cold in six minutes when conceding a soft try.
The start of their downfall came when, with nothing really looking on, David Whiteford was allowed to break into space before giving Macey an easy run=in. Wight converted.
A penalty into the corner by Murray Strang gave Heriot's their first look at the Melrose 22 after nine minutes and, maintaining the pressure, the Edinburghers created a penalty chance which saw Graham Wilson's kick cannon back off the post.
They were soon on the back foot again, though, and when David Whiteford intercepted on the blind-side of a ruck the winger was granted a clear run to the posts 40 yards upfield. Wight converted.
It hardly helped Heriot's chances of mounting a serious challenge when backchat saw a penalty against them advanced 10 yards upfield and although Marc Teague produced a brilliant cover tackle to deny Wight at the corner Melrose were not to be denied.
With 34 minutes gone Callum Anderson claimed try No 3 from a pass by Macey which Wight converted as he did when Wayne Mitchell rounded off a catch-and-drive with a try on the stroke of the interval.
It could have been even worse for Heriot's, too, with Wight missing two albeit awkward penalties.
Half time: Heriot's 0, Melrose 28
Things threatened to go from bad to worse for Heriot's when Wight stroked over a penalty to put Melrose 31-0 ahead after 48 minutes.
Mercifully the loss provoked Heriot's into a fightback which began when Colin Goudie ventured up from full back to send winger Cammy Goodall over too far out for Wilson to convert.
Maintaining momentum Heriot's struck again in 61 minutes when Strang's penalty into the corner set up a driving maul culminating in Innes Brown forcing his way over. Wilson converted from wide out.
Suddenly there were hope for Heriot's and when Oliver Brown wriggled through a gap following heavy forward pressure not only did they have a third try but the gap had narrowed to 31-17, the conversion attempt failing.
Following up Heriot's attacked again only to be denied by Jamie Murray's timely interception.
In injury time Heriot's at least gained the satisfaction of sharing the try count when Jim Thompson battled over, Wilson adding an excellent conversion.
Heriot's = C Goudie, M Teague, captain, J Thompson, R Mill, C Goodall, M Strang, G Wilson, B McNeil, N Meikle, W Blacklock, P Eccles, G Noonan, T McVie, C Simmonds, C Fusaro. Subs. - S Mustard, I Brown, G Anderson, J Parker, R Gray, O Brown, J Alston.
Melrose - J Macey, C Anderson, J Murray, captain, G Stewart, D Whiteford, S Wight, S McCormick, A Gillie, A Mitchell, R Higgins, G Dodds, A Clark, S Johnson, R Miller, W Wallace. Subs. - G Innes, N Bea von, R Ovens, S Ruthven, B Watson, A Jessop, S Renton.
Referee - J Steele (Dumfries).
Women's Final - Murrayfield Wanderers 15, RH Corstorphine 14.
Men's Plate Final - Portobello FP 21, Aberdeen University 27.
Men's Bowl Final - Preston Lodge FP 18, Dalziel 10.
Men's Shield Final - Garnock 31, Kirkcaldy 24.
Attendance - 5928