The Scarlets survived an extraordinary final passage of play to secure a crucial victory in arguably the game of the season in the Guinness PRO14.
Clinging on to a two-point lead, the visitors showed outstanding defensive discipline in the face of sustained Edinburgh pressure during a last play which went on for more than four minutes.
Right at the end, Scotland winger Darcy Graham escaped down the touchline, threatening to set up the winning score.
But the Scarlets scrambled back, turned over possession and got the ball off the park to signal scenes of jubilation.
It’s a vital win which all but secures their place in next season’s Champions Cup.
At this stage, it’s unclear whether the top three or four in each PRO14 conference will automatically qualify for Europe’s elite competition.
That’s because it’s not been confirmed whether the Champions Cup will stay at 24 teams - with eight PRO14 sides on board - or go back to 20.
But, either way, the Scarlets now look secure.
They lie in third spot in Conference B, eight points clear of the fourth-placed Cardiff Blues, with both sides having just two regular season fixtures left to play.
Edinburgh have two games in hand, but they are now 14 points behind the Scarlets following Saturday afternoon’s compelling contest.
It was a match which swung back are forth and contained some seriously bonkers passages of play, not least the final one.
Both sides looked to keep the ball alive and play, leading to a hugely entertaining encounter and some outstanding tries.
Edinburgh led 20-17 at half time, through touchdowns from Marcus Bradbury and Graham against wonderfully created scores for Tyler Morgan and Johnny McNicholl.
Then, soon after the break, scrum-half Dane Blacker popped up in support of Steff Evans’ double hack ahead to give the Scarlets a lead they were to hold on to until the bitter end, despite Dave Cherry’s maul score.
The visitors’ Tongan No. 8 Sione Kalamafoni was named man of the match, while there were also big displays from young flanker Jac Morgan and South Africans Uzair Cassiem and Pieter Scholtz.