For most of my leads, I've recorded several takes of improvisations and practice, then combined licks and phrases I like of each. I remember Jimmy Page saying that his lead to Stairway to Heaven was only one of several complete takes (although his favorite) in the studio. As for theory, the ultimate goal in the end is to not have to think about it, but feel it. I'd recommend learning as much as you can, but sometimes you gotta forget it all too...and just go with it!
[FONT=Palatino Linotype]"Bust a nut!" - Dimebag
"Imagination is more important than knowledge." - Einstein[/FONT]