Erections are neurovascular events, meaning that nerves and blood vessels (arteries and veins) are involved in the process of an erection and all must work properly to develop a hard erection that lasts long enough. Erection begins with sexual stimulation. Sexual stimulation can be tactile (for example, by a partner touching the penis or by masturbation) or mental (for example, by having sexual fantasies, viewing porn). Sexual stimulation or sexual arousal causes the nerves going to the penis to release a chemical, nitric oxide. Nitric oxide increases the production of another chemical, cyclic GMP (cGMP), in the muscle of the corpora cavernosa. The cGMP causes the muscles of the corpora cavernosa to relax, and this allows more blood to flow into the penis. The incoming blood fills the corpora cavernosa, making the penis expand.
The history can be useful in distinguishing organic from psychogenic impotence (Table 187.1). The patient with organic impotence describes problems with erection that progress over months to years. At first, the patient will have partial erections or seemingly firm erections that become flaccid during intercourse. With time, total erectile failure ensues. Organic impotence is constant and nonselective, meaning it is not better or worse with any specific partner or any type of stimulation.
Normal Male Sexual Ageing is ignored by health care professionals. There is never a clear discussion. The best that happens is that when it happens, instead of Male Sexual Decline being a known factor that should be quantified for each individual male by regular testing and awareness, the health care professional says, "Oh. This is normal.You can do other things and still keep sex enjoyable".
The first step in treating the patient with ED is to take a thorough sexual, medical, and psychosocial history. Questionnaires are available to assist clinicians in obtaining important patient data. (See Presentation.) Successful treatment of sexual dysfunction has been demonstrated to improve sexual intimacy and satisfaction, improve sexual aspects of quality of life, improve overall quality of life, and relieve symptoms of depression. (See Treatment.)
So what do you do? If the guilt is too much, you can tell your boyfriend. It might be the only way to clear your conscience — and hopefully, if you explain the reasons why you did such a boneheaded thing, he'll understand. It will be hard and it may create drama for months to come, but my guess is that you can recover, if he's not a horribly jealous guy.
Don’t give up or blame yourself - you shouldn’t assume that your situation is impossible to improve or that your partner is disappointed in you. Studies show as long as you don’t stop trying to engage your partner sexually, they will still respond positively. If you communicate and stay positive you can work with your partner to get the result you’re looking for.
A common and important cause of ED is vasculogenic. Many men with ED have comorbid conditions such as hyperlipidemia, hypercholesterolemia, tobacco abuse, diabetes mellitus, or coronary artery disease (CAD).  The Princeton III Consensus recommends screening men who present with ED for cardiovascular risk factors; ED may be the earliest presentation of atherosclerosis and vascular disease. 
If you have symptoms of ED, it’s important to check with your doctor before trying any treatments on your own. This is because ED can be a sign of other health problems. For instance, heart disease or high cholesterol could cause ED symptoms. With a diagnosis, your doctor could recommend a number of steps that would likely improve both your heart health and your ED. These steps include lowering your cholesterol, reducing your weight, or taking medications to unclog your blood vessels.
Qaseem, A., Snow, V., Denberg, T. D., Casey, D. E., Forciea, M. A., Owens, D. K., & Shekelle, P. (2009). Hormonal testing and pharmacologic treatment of erectile dysfunction: A clinical practice guideline from the American College of Physicians. Annals of internal medicine, 151(9), 639-649. Retrieved from http://annals.org/aim/article/745155/hormonal-testing-pharmacologic-treatment-erectile-dysfunction-clinical-practice-guideline-from