I didn't read this entire thread so don't know if someone posted this or not, but on our 2004 we had similar issues with the shifter not operating correctly. I found out the problem is the solenoid attached to the brake pedal. When you press the brake pedal a little switch is depressed and that tells the solenoid to release the shifter so it can shift into and out of park. You can freely shift between R, N, and D I believe without holding the brake, but not in or out of P. The brake pedal needs to be pressed(and the solenoid switch depressed) to shift in or out of P. You also can't remove the key if not in P I don't believe.
If you get under the dash and with your hand follow the brake pedal lever up into the dash you will feel the little switch(think of the older cars that had a switch for the dome light in the door jambs....it's like that). I found that usually just reaching up there and pressing it in and out a couple times fixed the problem(for a few weeks/months). After it happening several times I decided to spray wd-40 in the switch and work it in and out. I probably did that a few times over a year ago and the problem has disappeared.
You should also notice that your brake lights do not work when you have this problem(also a safety concern...). The brake lamp switch and shifter switch are operated on the same solenoid.
You can push a key into the slot next to the shifter to "unlock" the solenoid manually to shift it into park and remove your key if it gets stuck.