I ran into a situation a while back (right after my wife left, as a matter of fact). I was working at a Little Caesar's Pizza place (as a delievery guy) and started having this infatuation with one of the teenagers who was working there part time.
Understand, not only am I still legally married, had already started standing in faith that God would restore my marriage, but was many, many years older than this girl.
In the end it was mostly emotional back-wash in my life from the situation I was in.. but I found that once I confided in someone whom I could trust, the power this situation had over me disapeared and it pretty much went away almost instantly.
See, I knew the whole thing was nuts, it was wrong... but it was one of those things you just don't tell to people.... a similar issue had already done lots of damage in my marriage, and I knew that.
I'm not saying that this is your situation, but more to the point that we can get feelings from all sorts of places... but feelings shouldn't dictate our actions, and often times they aren't even very accurate.
I agree that you SHOULD NOT tell the teacher this... no telling how they will react and most of your peers won't be as "understanding" as they should be.
Find a close friend or a good solid mentor in your church to confide in, pray over it, and release it to God.... that's not to say you can't be on good terms with the teacher, but most won't want (and really shouldn't) be "buddy/buddy" with their students for ethical reasons as well as others.
Oh, and don't feel bad about the situation either... I've lost count over the years of how many women I've become a blithering idiot in front of.