Hi, I hope this isn't much of a dead thread revival. I'm a Subaru tech in Nashville. I read through this after having a client come in with a 2013 XV with this very same issue. I ran through the troubleshooting diagnostics and came down to this (and I was able to duplicate the concern). First, let's go through the symptoms for anyone that has posted. This client intermittently, yet more frequently as of late, can put the car in Park, turn the key all the way back (2 clicks) to the off position, where key can be removed, but the key fails to come out. The ignition has essentially remained locked, due to getting a signal indicating the car is in any other gear except Park. With some wiggling of the shifter or cycling again through the gears, the key eventually comes out. What's happening is the P Range switch in the shifter assembly is getting stuck in, albeit from a previously spilled beverage or grease getting on the contactor or something else (maybe even slight corrosion due to humidity) that migrated down around the panels and gummed up the switch itself. It's a simple 2-wire switch. It's not the easiest to replace but it can be done. It's the connector directly in front of the shifter assembly (with the panels removed). Pins 1 and 2 of connector B116 are for this switch. Replacing this should fix this (assuming it too doesn't get gummed up by something later).
For those worried about running out of warranty before this is repaired, don't worry. If you brought this complaint to your dealership's attention and it has yet to be properly remedied - so long as you did this while you still had SAS coverage, they are obligated to repair this even after your warranty expires. But be persistent and get this in and contact the service manager if you're not satisfied with the Service advisor handling this effectively.
If you have further questions on this subject, give me a holler!
- Sarge -