it *could* be allergies..lots of medicines that people have allergies too do get a gagging throat closing type situation...could be GERD or some reflux problem as well. You could *try* short term ant-acid like tums without laying down just to see if there's any improvement but a good person to see would be a GI specialist and ask your family doctor if thyroid could be a problem and to do blood tests for it. If you just started a new medicine of some time that could be the culprit or something you're allergic too might have caused this (without knowing what you're allergic to) a GI specialist is probably best.
Good luck though that doesn't sound fun :S
You don't say what problems you have with your thyroid, but I do know that difficulty swallowing can be a sign of a thyroid problem. I would contact your Endocrinologist and see if it is related. I truly don't think it's allergies.