Hey mikester have you fixed the problem yet?
I had a similar problem recently except my cruise control would not come on instead. Sometime the shifter and the cruise control would work just fine and other time it would not. I believe my problem was a loose connection on the brake switch. Like SSCULLY said it is big black switch with 4 wires out of it on a connector and a bright yellow c-clip housing on it. When I finally found it and put my hand on I move it all around and made sure all the connection where good and my truck works fine now.

If your problem happens all the time you might need to change the switch itself