It was an astonishing five minutes for the new Ulster rugby signing Ian Madigan as he kicked a conversion and penalty to secure a Pro14 final against Leinster.
Tries by Stuart McInally, Darcy Graham, and Chris Dean had given Richard Cockerill’s side a 19-7 lead.
But Rob Herring and John Andrew’s tries added to Rob Lyttle’s earlier score as the visitors drew level with only five minutes left.
And Ian Madigan’s 80th-minute penalty secured Dan McFarland’s team victory.
Ulster will take on six-time winners and current defending champions Leinster at Dublin’s Aviva Stadium in a repeat of the 2013 Pro12 final.
Edinburgh:Â Kinghorn, Graham, Bennett, Dean, Van Der Merwe, Van Der Walt, Groom, Sutherland, McInally, Nel, Toolis, Gilchrist, Bradbury, Watson, Mata.
Replacements:Â Taylor for Dean (59), Shiel for Groom (76), Schoeman for Sutherland (52), Willemse for McInally (69), Berghan for Nel (48), Davidson for Toolis (69), Ritchie for Mata (64). Not Used: Chamberlain.
Ulster:Â Stockdale, Ludik, Hume, McCloskey, Lyttle, Burns, Cooney, O’Sullivan, Herring, O’Toole, A. O’Connor, Carter, Rea, Murphy, Coetzee.
Replacements:Â Lowry for Ludik (41), Madigan for Burns (70), Mathewson for Cooney (41), McGrath for O’Sullivan (52), Andrew for Herring (70), M. Moore for O’Toole (52), Treadwell for Carter (49). Not Used: Reidy.
Ref:Â Frank Murphy (Ireland).