Hmm... looks as though, while I was typing you arrived at a solution? That's good. I'll go ahead and post this info strictly for reference, then.
Begin Reference Data.
The reason that headphone use is supposed to cut off the speakers is that most manufacturers (and this usually includes HP) use a headphone jack in circuit with the speakers such that plugging in headphones physically opens the circuit to the speakers. There is the possibility there is something physically wrong with the jack.
More than most folks would ever want to know about these connectors (and more similar connectors in the same family) can be found at:http://en.wikipedia.org/wiki/TRS_connector
The stuff most relevant in your case is in the sections on Switch Contacts
and, further, in Usage - Computer Sound.
That aside, a lot of newer laptops have a sensing contact in the jack that communicates with software to accomplish switching
, so a combination of hardware and software is used (I never liked this setup, personally. As a certain Scottish starship engineer once remarked, the more complicated the plumbing, the easier it is to stop up the drain.) Do as suggested previously to check out your software setup, but don't be surprised if this turns out to be the jack.
If it does turn out to be a hardware problem, it's going to be dicey getting the right jack to be able to replace it because you'll first have to locate a supplier savvy enough to sell you the right one, and then do some de-soldering to remove the old one, and solder the new on in its place. This is work best done by a professional. If you're lucky, depending on your particular model, you might be able to replace a small daughter board that has the audio jacks on it, but this is not commonly done even though the audio jacks are a common point of failure.
Some models (very rarely) have a hardware or (more commonly) software "mute" that interrupts signal to the speakers, too. A stroll through the laptop's users guide might be illuminating there.End of reference data.