Edinburgh claimed a much-needed Guinness PRO12 victory after squeezing past Scarlets 24-23 in a hard-fought encounter at BT Murrayfield.
High-flying Scarlets outscored Edinburgh three tries to two but it was the Scottish side who emerged victorious to boost their push for next season's Champions Cup and keep them in the hunt for a play-off berth.
Edinburgh had suffered three successive defeats in the competition coming into the match but the triumph allowed them to leap-frog above Glasgow in the table and to within seven points of second-placed Scarlets.
Scarlets, who were forced into a late change that saw high-scoring winger DTH van der Merwe replaced by Steffan Evans, kicked off in glorious sunshine.
First-half play was as pleasing as the weather with 39 points registered as Scarlets recovered from an early 10-3 deficit to go into the break leading 23-16.
After Edinburgh full-back Blair Kinghorn and Scarlets number 10 Aled Thomas traded early penalties, the hosts took the initiative and their stand-off Phil Burleigh touched down the first try of the match after good build-up, with Kinghorn converting.
Scarlets hit back with a penalty from Thomas followed by an unconverted try from centre Hadleigh Parkes, who benefited from a high bounce off a loose Edinburgh pass on the firm turf.
A penalty from Kinghorn put Edinburgh back in front at 13-11, but Scarlets swung into gear in the second quarter with tries from flanker James Davies, making his first appearance since November, and winger Evans.
Thomas converted the latter but Kinghorn's 40th-minute penalty kept the hosts in touch as they went in at the interval trailing by seven points.
And Edinburgh were m uch more focused from the re-start, Kinghorn slotting over another three-pointer in the 42nd minute before a 'try' by Burleigh was ruled out by referee Dudley Phillips for a double movement.
Again Scarlets came strong as the midway point of the second period arrived but their play had lost its first-half sparkle.
They still led 23-19 heading into the final 12 minutes but a burst from replacement flanker Magnus Bradbury took Edinburgh to the line in the 69th minute, where lock Ben Toulis barged over for an unconverted try.
That put Edinburgh into a one-point lead and, with Thomas missing a penalty to put Scarlets back into the lead, the home side held on to end their losing run.