Dafydd Jones saved the Scarlets' Heineken Cup campaign with a try deep into injury time to snatch victory.
HEINEKEN CUP POOL SIX
Scarlets (5) 15
Tries: Popham, D. Jones
Edinburgh (7) 13
Pen: Paterson 2
Flanker Jones, playing his first game for nearly two months, levelled the score when he dived over and Gareth Bowen's conversion clinched the points.
Edinburgh scored first through a Scott Murray converted try, but Alix Popham replied for a 5-7 half-time scoreline.
Two Chris Paterson penalties took the Scots clear, but a late Bowen penalty and Jones' try completed the comeback.
Replacement Jones emerged triumphantly from under a pile of bodies after a forward drive from a line-out nine minutes into injury time.
And Bowen held his nerve to convert just to the right of the posts.
Edinburgh's opening try came in similar fashion after 17 minutes when Murray touched down in the corner.
With their line-out game all at sea, the Scarlets were on the back foot for long periods of the first half, but somehow they managed to hold out and Popham got them on the board in first-half stoppage time.
Full-back Lee Byrne set up the Wales number eight after Regan King had capitalised on spilled Edinburgh possession.
With the weather deteriorating, it was Edinburgh's turn to roll up their sleeves as the home side piled on the pressure after the break.
They did just that and on 58 minutes Paterson landed a penalty from 30 metres to extend the lead to 10-5.
A 78th-minute penalty by Paterson looked to have clinched a second Pool Six win for the Scots, but the Scarlets forced a series of late penalties and made the visitors pay.
Scarlets coach Nigel Davies:
"We made it very difficult for ourselves, we knew it would be a tough challenge anyway against an Edinburgh side with a very good line-out, but our line-out didn't function yet again.
"Some might say we were lucky, but we dug in there and kept in there until the end.
"We are not going to beat the best sides in Europe playing like that but we were very committed and kept our composure which we weren't doing this time last year.
"We have now got a lot of work to do on our game over the next month ahead of what is going to be a huge December."
Edinburgh coach Todd Blackadder:
"It is bitterly disappointing for us, but Stradey is a hard place to come and we showed a lot of resolve out there.
"I was very proud of our players, particularly for the way they played in that second half when Llanelli came out fighting. I was just disappointed we couldn't finish it off.
"We blew opportunities in the first half and didn't maximise the pressure we exerted.
"This pool was always going to be an uphill task but we came away with a bonus and it could be crucial in the final stages."
Scarlets: Byrne; James, Watkins, King, M. Jones; Bowen, L. Davies; John, Rees, J. Davies, A. Jones, Afeaki, Mills, G. Thomas, A. Popham.
Replacements: G. Evans for M. Jones (78), Madden for J. Davies (78), D. Jones for Mills (42).
Not Used: Hawkins, Wyatt, B. Davies, Hercus.
Edinburgh: Southwell; Paterson, Di Rollo, Jorgensen, Webster; Godman, Lawson; Jacobsen, Hall, Smith, Kellock, Murray, Mustchin, Taylor, Hogg.
Replacements: Dey for Jorgensen (77), Blackwood for Lawson (73), Strokosch for Mustchin (40).
Not Used: Kelly, Wharakura, Pringle, Hodge.
Referee: Tony Spreadbury (Bristol)