Vietnamese and Thai are normally classified into separate primary language families, meaning that the languages as a whole are unrelated. Whenever you find a similar word with a similar meaning, that could be a coincidence; or it could be a borrowing either way; or it could have been borrowed into both languages from (say) Mandarin or French either of which belongs to yet another language family.
The words you ask about are, in all likelihood, completely unrelated.
Vietnamese "lệnh" is a borrowing from, as far as I can tell, Middle Chinese. "Lệnh" means "order" as a noun (a written instruction - which is perhaps not too vague in meaning), while the Thai "เลย" seems (according to the wiktionary entry of its cognate word "to be left over") to have its origins in Proto-Tai, with a reconstructed pronunciation /ʰlɯəᴬ/. I treat those two modern Thai words as cognates because wiktionary lists the same Ahom language reflection for both of them; Ahom itself is long extinct.
The meanings of either word in present day Thai don't seem to come recognizably close to the meaning of "order", and the reconstructed Proto-Tai form /ʰlɯəᴬ/ (unvoiced dental lateral; unrounded vowel "u"; mixed vowel; all this with a mid level tone) doesn't look too similar to the hypothetical precursors of the Vietnamese which are Middle Chinese /liᴇŋ/, departing tone, or Mandarin /liŋ/, (the corresponding) falling tone.
This can't disprove a subtle ancient connection, or even a recent folk etymology influence, but the words appear to have many centuries of independent histories behind them and aren't coming recognizably closer if we try looking back a little, neither phonetically, nor semantically.
Note: This answer has been substantially changed since my original attempt. I had misunderstood a particular reference as pointing to yet another language family which actually isn't involved in the history of either word. Sorry for the confusion. Other parts of the answer were expanded to compensate.