Unplugging and replugging headphones fixes it? I'm definitely not an expert on computers, but you might try reinstalling the audio driver on your computer? Plugging it in seems to be triggering something to restart or reset...
I assume you've done some troubleshooting to make sure it's not the headphone cable?