Wales international Priestland, who came off the bench on 55 minutes, slotted home a 78th-minute penalty to secure maximum points for the visitors who had notched four tries by half-time.
Two tries from Welsh wing George North and one each from Nick Reynolds and Gareth Davies secured the bonus point within 40 minutes but Tim Visser's first-half effort and Leonard's persistence kept them on their toes.
Both sides were keen to make up for a disappointing European break and it was the Scarlets who started on the front foot with a powerful break from Samson Lee, named in the Welsh squad for the autumn internationals, in the third minute.
The prop fed Davies but his run ended fruitlessly with the attack fizzling out on the left.
The home side responded though on eight minutes through the returning Visser who notched his ninth try of the season.
After initially being halted down the left, the Scotland international shifted inside to pick up Chris Leck's pass and power his way through under the posts.
Leonard added the extras but just five minutes later the scores were level when North crossed in the corner after a period of pressure from the visitors.
Morgan Stoddart did the hard work, before the Welsh wing touched down his sixth RaboDirect PRO12 try of the campaign - Aled Thomas kicking a difficult conversion.
Leonard, not to be outdone, restored the hosts' lead with a penalty on 19 minutes, awarded for a collapsed scrum, seven metres outside the 22.
But just a minute later Edinburgh's weak defence was highlighted when Davies galloped from the scrum to feed Reynolds, with Thomas easily converting.
Leonard kept the scoreboard ticking over with two sweetly-struck penalties, restoring Edinburgh's lead in the process.
But their frailties were exposed again on 32 minutes by North who beat Stuart McInally and John Houston before crossing the whitewash.
Leonard tried his best to keep his side in it by kicking his fourth penalty of the evening but another McInally mistake sent the Scarlets in with a 26-19 half-time lead.
The Scottish No.8 spilled the ball in the dying seconds and Davies took full advantage as did Thomas with the conversion.
Despite a couple of incisive Visser breaks the hosts failed to add to the half-time score early on but Davies saw yellow on 50 minutes.
They made the extra man count through Leonard, who maintained his impressive form with the boot with three more penalties in the space of 12 minutes to regain the advantage: 28-26.
But the final act fell to Leonard's opposite number Priestland - the replacement slotting the decisive penalty with two minutes of play remaining.
|Edinburgh Rugby Score Card|
|Scarlets Score Card|