might be an electrical connection tied in w/ the starter. since when u bang on it it starts, but otherwise just clicks. sounds like the solenoid is popping out, but the starter isn't spinning. most likely a bad starter. but since u mentioned the headlights causing a no start, also check into the alternator. sounds like the battery isn't getting charged all the way back up. y would u turn u'r headlights on before starting the car anyway??? that just makes the battery work that much harder.