The important thing to remember, I mean the really important thing, is that theory is descriptive, not prescriptive. It is very useful in describing what you've already played, but it should not be used to prescribe what you should play. Knowing theory has helped my playing most when I'm analyzing what another guitarist has done over this or that set of changes.
When I'm playing, I never think "oooh, I need a flat-7 here". I hear a note in my head, understand what scale or shape or form will deliver it, and hope I can tie this stuff together enough to be coherent. Any solo of mine, if improv, will float between keys and modes with no regard to "this is the proper note to play here", because I want to play guitar, not typewrite. Sometimes I want sour, or out-of-key, or evocative of some other mood.