POSTS 2,3,4 all said head light switch. Did you ever look at the pigtail going to the switch? Mine was melted pretty bad causing my dash/ tail lights not to work unless I smacked the dash.
Maybe the melted connector is on your h/l circuit and the arching is causing the lights to flicker.