Please let us know what you find. I have a 2002 540iA with 87xxx miles and I had this exact problem today. Driving from one job to the next, I got the transmission fail safe cruising down the interstate at about 70mph. I got stuck on an exit ramp (to another interstate) and the car would not move in reverse or drive, including sport mode when I tried to put it in each of the 5 different gears. I get the same clicking noise as the OP when I put it back in park while the car is running. I did not know if this is damaging something so now I start and turn the car off in neutral. My car also will roll while in park if I do not engage the e-brake. I've had no prior symptoms/warning. The car hasn't been wet in some time, so I don't THINK that would be an issue in my case. The last two nights were the first two cold nights (30-32 degrees overnight). However, I drove the car 20+ miles to work this morning with no issue. I haven't tested alternator or anything yet. I've only pulled battery terminals at this point.
Also, I only saw the fail safe message in the beginning. Since the car was first turned off, I have not seen the message again. I did see a check engine light once before I was towed home, but it quickly went away and I have not seen it again. Perhaps I'll go put my car up on the jack and see if I get lucky too..? o_O