What about wet dreams and things like that that you can't control?
There's a pretty clear separation in the Bible between involuntary bodily functions and active lust. The Levitical laws state that when a man has a "discharge," he is
ritually unclean, a category of things that happen naturally and usually without conscious thought (women menstruating falls into the same category, for instance). They're a symbol of the imperfection of human experience, but not a "sin."
Coveting someone who is not your wife, on the other hand, is not only a sin, but one of the biggies. The shorthand for that is "lust." This
does involve action: instead of letting a natural lustful thought pass, you develop it, dwell on it, and perhaps even act on it, either through masturbation or adultery. This is a sin, period.
There is nothing in Scripture specifically condemning masturbation, and it is possible for a man to bring himself to [bless and do not curse][bless and do not curse][bless and do not curse][bless and do not curse][bless and do not curse][bless and do not curse] without active lust. This is especially true early in puberty when your anatomy is just beginning to absorb all the changes going on; and for men with high sex drives, that trend can continue later in life. Thus, whether your ejaculations are a result of your natural anatomical reactions or some purposeful lustful act is something only you can really know about yourself.
That said, what you're describing--using lustful thoughts to aid masturbation--is clearly and unambiguously sinful. But like all sins, God stands ready to forgive you for it. Seek His forgiveness, and move on with your life: don't dwell on your sin or be overcome with guilt.