I had a similar issue on 02 freelander where i was stuck in park, conveniently it was at the shop for new brake pedal switch when this happened when i replaced the switch it worked fine again. I do know that there is a brake pedal switch and a brake pedal sensor possibly one is busted but the other is not allowing your lights to work (check for power to both). not sure if that's what you were looking for but thats all i got.
P.S. if you put the solenoid back in and it happens again turn key one click then you will be allowed to shift into neutral and turn the car on then it will function as normal until you shift back into park.