I had this same problem when I was using a HP compaq laptop. I found a setting in the volume control applet, that by ticking it, it detects if the headphones are plugged in, it turns the speakers off. if there are no headphones then the speakers are on.
if I remove the tick then sound plays through both. I cant recall the exact wording for the tick box as I'm using a modified verson of alsa at the moment. but I just ticked a few things when I had my head phones in and figured out which one it was that was doing it. If this is the cause of your headaches i'm sure when you find it you will do what I did. when you find it you'll think to yourself "OOHHHH I guess that makes sense..... somehow. ???" I am still shocked over how long it took me to fix it. I think it took me at least a month.