Could sugar in your diet lead to erectile dysfunction? That hasn't been proven yet, but it's inevitable and here's why:
Scientists have discovered a new risk factor for heart disease: sugar consumption. We're all familiar with other cardiovascular risk factors that include saturated fat/cholesterol, low HDL, triglycerides and so on and, as I have shown, the Penis and the Heart are intimately linked. If you injure the lining of your arteries and coat it with calcifying plaque, you can expect your erectile strength to go down accordingly. The arteries that supply blood to the penis and the veins within the penis are some of the first to be noticably affected.
This means that, for the sake of your sex life (and life in general), you need to be working on all cardiovascular risk factors and that now includes sugar consumption. One recent study of Americans found that sugar was correlated with higher triglycerides and lower HDL levels. Researchers grouped participants into five groups based on the amount of sugar consumed and found that, for men, the more the sugar, the worse the lipid profile.  And researchers almost always find out that anything that negatively impacts your lipid profile will lead to erectile dysfunction and impotence.
The researchers found that the average person takes in 16% of their calories in the form of simple sugars. For the typical guy, this means around 400 of his calories come from sugar, i.e. 100 grams. This is enough, according to the study, to elevate our lipid profiles negatively and increase risk of heart disease.
Of course, part of the reason sugar is so hard on the heart is that half of standard table sugar is fructose and you can read more about the Negative Effects of Fructose on Heart and Erections elsewhere on my site. However, glucose, the other half of table sugar, is nearly as evil. Glucose will, of course, raise blood glucose levels and, if high enough, elevated blood glucose levels will lower endothelial nitric oxide in various tissues throughout the body, including your blood vessels.   And decreased nitric oxide means higher blood pressure and less blood flow for your erections.
One of the key reasons that glucose lowers nitric oxide is that it increase superoxide, one of the "evil" free radicals generated within the body, which impairs calcium metabolism leading to decreased nitric oxide. 
Sugar also has long term effects as well: it gives you a nearly instant high from endorphin production and thus stimulates you to eat more and more often than you should. That and the extra calories will help you to put on weight and those extra pounds are correlated with lower testosterone and increased erectile dysfunction.
So long term or short term, sugar is going to be bad for your sex life.
1) JAMA. 2010, 303(15):1490-1497., "Caloric Sweetener Consumption and Dyslipidemia Among US Adults"
2) The Journal of Biological Chemistry, May 23, 2003 , 278:18791-18797, "High Glucose Inhibits Insulin-stimulated Nitric Oxide Production without Reducing Endothelial Nitric-oxide Synthase Ser1177 Phosphorylation in Human Aortic Endothelial Cells"
3) Nephron Exp Nephrol, 2003, 95(2):e62-8, "Effect of high glucose on nitric oxide production and endothelial nitric oxide synthase protein expression in human glomerular endothelial cells"
4) Am J Physiol Endocrinol Metab, 2001, 280: E171-E178, "Impairment of endothelial nitric oxide production by acute glucose overload"