Duncan Weir's last-gasp drop goal secured four vital points for Edinburgh in the Guinness PRO14 as they won 17-16 at Ulster.
The win means they overtake their hosts in third place in the table.
The Scots now have an edge on the Irish province in the race for the top three play-offs, though both sides are on equal points in the table after Ulster, who slipped to fourth, gained a losing bonus point.
Tries from winger Jason Harries and lock Lewis Carmichael along with two conversions from Sam Hidalgo-Clyne, along with Weir's drop goal, earned the Scots the four points.
All Ulster's points came from John Cooney.
After the sides were tied 7-7 at half-time, the Irish province stretched their lead to 13-7 before the visitors, who dominated the second half, came back to take the game with the last play.
After losing Craig Gilroy after just six minutes, Ulster - playing into the strong breeze - had a try two minutes later when Cooney scored at the posts following good work from Nick Timoney and Louis Ludik, with the scrum-half then converting his own score.
Visiting flanker Viliame Mata then came inches short of scoring in the 29th minute only for a double tackle from Rob Herring and Timoney to knock it from his grasp with Nigel Owens going to the TMO to confirm the ball had been spilt.
But the Scots scored next when Hidalgo-Clyne broke clear from his 22 and chipped for winger Harries to beat Tommy Bowe to the touchdown.
Hidalgo-Clyne converted to tie the scores after 34 minutes, which also saw Ulster's Johnny McPhillips leave the field with a serious-looking arm injury.
The half ended with no further score and the sides locked together at 7-7.
That became 10-7 two minutes after the new half began after a long-range penalty from Cooney.
Cooney kicked a second penalty on 54 minutes to stretch Ulster's lead to 13-7.
But the Scots roared back with lock Carmichael smashing through some tiring Ulster tacklers to score in the 62nd minute with Hidalgo-Clyne's conversion putting them in a one-point lead.
Three minutes later, though, Ulster had the lead again through Cooney's third penalty.
But the home side were unable to then end Edinburgh's almost incessant pressure and prevent Weir's last-gasp drop goal.