We're only as strong as our weakest link and the thyroid is no exception: if you have any dysthyroidism, you are very at risk for erectile dysfunction and a host of other health issues. One recent study found that those with either hypothyroidism (underactive thyroid) or hyperthyroidism (overactive thyroid) were signficantly more at risk of erectile dysfunction or impotence.  Admittedly, this study was small, but the researchers found that the dysthyroid males in this study had three-and-a-half times the rate of erectile dysfunction as controls.
The thyroid affects so much that it is no wonder. For example, both hypothyroidism and hyperthyroidism can lead to fatigue and, of course, fatigue can lead to lowered libido and decreased erectile strength no matter what the source. Furthermore, hypothyroidism has been associated with lowered testosterone levels, which can also sabotage your erections. 
You can read below the classic symptoms of hypothyroidism and hyperthyroidism if you think it applies, but I want to emphasize that the above study  found that most of the study participants with thyroid problems and erectile dysfunction had very significant improvement after their thyroid condition was treated.  If you have thyroid issues, it is likely that simply getting your hormone levels back in normal ranges may get you back in business under the covers without doing anything else! And it will also likely get rid of the mental, intestinal and weight issues that you likely have been experiencing as well.
Here are classic hypothyroidism symptoms:
Here are some of the classic hyperthyroidism symptoms:
1) The Journal of Clinical Endocrinology & Metabolism, 2008, 93(5):1815-1819, "Erectile Dysfunction in Patients with Hyper- and Hypothyroidism: How Common and Should We Treat?"
2) Hormone Research, 1990, 34:215-218