Why does my Mazda Proteges overdrive go off and on on its own?

My Mazda Protege LX did the same thing, especially when it was hot out. I eventually found out it was a loose wire behind my overdrive switch located in the shift column. The overdrive button pops right out with a tight grasp and a little tug. See if both wires are still connected to the switch.