Had this happen on my Nissan, and now on the Mazda. On the 240SX, a friend said I was driving down the road with my reverse lights on. I found two switches on the tranny, swapped them and the lights were good. The other switch was directly opposite the reverse switch, so I figured it my be switched when the car is in 5th gear.
I noticed some broken wires under the Mazda, again opposite the reverse switch, and took a look at my Haynes and saw an entry for "5th Gear Switch". It is in the addendum that covers '88-92 626 FI models. It didn't say what it did, it just showed the connection and gave a method for testing it.
According to about the only thing I could find on the Internet pertaining to a Toyota P/U 5th gear switch, it seems it cuts out the emissions.
Any ideas?