Wait!!!
I may know this one!!
Well, maybe...
That might be "Getting Lucky" a film about a poor earth-loving nerd who's in love with a cheerleader and one day when finding bottles for recycling he finds a leprechaun trapped inside one of these bottles. Kinda like a magical rehab.
Basically that scene you're describing is the bit that transforms this film from idiotic, to utterly brilliant. Terrible theme song music of 'You can't get much closer' etc whilst our hero is clamouring inside his beloveds undergarments whilst she is in class listening to her history teacher tell the class of the early settlers, and making lots of pounding motions whilst explaining it.
Haha, great movie, even if that isn't the one, but really, how many leprechaun films would have someone do that? Boy I hope there are more...
http://www.imdb.com/title/tt0099648/EDIT BY ANDREW: Fixed link.