Hmmmmm!
You said it is just the headlights. You confirmed that it just the headlights, did you notice if the interior lights went as well. It does sound like a lose connection. I suppose you checked the obivious and your battery terminal connections are good and tight. After all that can you...