I got this trick from Nacrazytrain who got it off the Janick Gers DVD.
It works best on Strats. Place a finger of the fretting hand just before the mid-position pickup. Depress the string all the way. You have to get the exact right spot so it will ring out too far in either direction will only let the note ring for a second or so. You can do it on any of the strings but it sounds best on the high E string. BTW, if you want to get a really cool sound as well as to annoy your friends, while depressing the string with your fretting hand, use your picking hand to work the whammy bar with short dips.