Scarlets suffered a huge blow to their Guinness PRO14 play-off hopes after Edinburgh produced a strong second-half comeback to claim the spoils at Parc y Scarlets.
The home side led 12-0 at half-time thanks to tries from Wales internationals Gareth Davies and Jonathan Davies.
But inspired by man of the match Jaco van der Walt, Edinburgh posted 20 unanswered points after the break to move them six points clear of the Scarlets in the play-off race with only two rounds remaining.
The match between fourth and fifth in the Conference B table had been billed as must-win by head coach Wayne Pivac, who had demanded far more energy and physicality from his side in the wake of their disappointing loss to Cardiff Blues at the Arms Park.
For the opening half hour he got just that as the home side, bolstered by six returning Grand Slam winners, caused Edinburgh all sorts of problems with a high-tempo attacking game.
With the Scarlets putting the ball through the hands, they constantly probed the wide channels and their ambition was rewarded with the game’s first try on 11 minutes.
An inside pass from Dan Jones saw Leigh Halfpenny slice open the visitors’ defence with a scything attacking run; the full-back then found Gareth Davies, who produced a trademark sidestep to beat the last defender and cross at the posts. Halfpenny added the extras.
It needed a crucial scrum penalty on their own line for the Scarlets to keep Edinburgh at bay and on 24 minutes the home crowd were celebrating a second score.
It was another scintillating effort from the Scarlets, started by a smart chipped drop-out from Dan Jones, which landed perfectly in the arms of Johnny McNicholl.
McNicholl hared upfield and with the Edinburgh defence stretched, wing Steff Evans put Jon Davies over on his inside.
Scarlets skipper Ken Owens was shown yellow two minutes before the interval, but Edinburgh fly-half van der Walt pulled his penalty attempt to ensure the home side went in at half-time 12-0 to the good.
Edinburgh, though, came out for the second half with real purpose.
Van der Walt landed a penalty from straight in front then the Scarlets came close to a third score when Jon Davies and McNicholl combined out wide, only for referee George Clancy to penalise Halfpenny for a neck roll.
As the game went on, Edinburgh grew in confidence.
Centre Matt Scott, a late inclusion for Chris Dean, cut through to begin the comeback, then man of the match van der Walt intercepted a Halfpenny off-load to race 60 metres unopposed to the line.
The fly-half converted and added a further penalty and despite the Scarlets’ late efforts there was no way back.
SCARLETS - Tries: G. Davies, J. Davies. Con: L. Halfpenny
EDINBURGH - Tries: M. Scott, J. van der Walt. Cons: J. van der Walt (2). Pens: van der Walt.
Referee: George Clancy (IRFU)