toss em in the oven
set your oven at about 275°F. take your headlight and set it in and leave it bake for about 10-15 min. make sure you monitor it just incase it gets too hot in there and it ends up melting the housing or the glass. then take out the headlight and pry it open carefully. the glue thats holding the taillight housing and glass together gets melted and it will just come right off. thats how i did mine and it worked just fine. reverse the process to put them back together. but since your going to paint them im not sure if the paint will hold up to the heat...dont panic you can always use silicon to seal them back up!
good luck