Hi Marc, the biology part can be a reflex and does not need an erotic dream. So, if one’s response in not the result of thinking about that which is not pure then it is pure biology and thus not sin. But, if it is related to erotic dreams which we do have control over by the displine and grace of viewing that which is pure, good ( phil 4:8 ).
Men get reflex erections during rapid eye movement (REM) sleep, which occurs during the middle and late stages of the nightly sleep cycle. Erections also can occur when boys and men are afraid, angry, or totally stressed. If a man’s prostate gland is enlarged, the pressure from the prostate (this organ, when stimulated, can cause feelings of sexual arousal) can result in an erection. In addition, when a person has a full bladder, the pressure exerted by the bladder upon the prostate gland can cause erections. Finally, if one uses drugs recreationally, such as ecstasy, which can increase one’s susceptibility to sexual arousal, erections may arise (no pun intended). Similarly, using Viagra can also help bring about the conditions needed for erections to develop.
goaskalice.columbia.edu/0863.html
So, I would agree if the cause is strickly biological or stress related it would not be sin.
But, if the event is related to thinking on the wrong things, then it is sin. And, we have control over what we view.
Psalms 119, recommends that we mediate on God’s word.
Psalm 119:9-11 (New International Version)
9 How can a young man keep his way pure?
By living according to your word.
10 I seek you with all my heart;
do not let me stray from your commands.
11** I have hidden your word in my heart
that I might not sin against you.**
Philippians 4:8 (New International Version)
whatever is true, whatever is noble, whatever is right, whatever is pure, whatever is lovely, whatever is admirable—if anything is excellent or praiseworthy—think about such things.
that which is praiseworthy would include God’s Word and any examples of living a godly life, like saints.