I have been having this issue and I think I have cracked it!
There's a mechanism that triggers when the gear-selector is moved out of Park and a solenoid in the ignition barrel locks the key in place. When the selector is moved back into Park, this mechanism disengages and the solenoid releases the key...or at least it would do if all was well!
After pulling up the gear-selector surround and gaiter I managed to identify the mechanism that triggers the key lock / unlock solenoid.
When the gear-selector is pushed forward and locked into Park a button is pressed, which in turn activates a solenoid in the ignition barrel that unlocks the key. If the selector is not in Park then the button is released and the ignition barrel lock is engaged.
However I found that there was some "play" in the selector so, even though the selector was in Park (the transmission lock engaged, the digital display in the dashboard showed "P" and the "P" symbol next to the selector lit up), it was not sitting forward enough to activate the release.
If this happens to you (can't turn key back to the "off" position and it wont come out), put the car in Park and then push the selector forward. If it needs adjusting / has too much play, you should hear the "click" of the switch but then the selector "springs" back and the switch disengages when you stop pushing on it. If you do this with the ignition on, you will also be able to hear the click of the solenoid in the barrel too if the circuit is working.
To release your key do the following:
1. Make sure the ignition is on (the engine doesn't need to be running, just turn the key until the dashboard lights up) and the selector is in Park
2. Push the selector forward until you hear the click
3. While holding the selector in this forward position, you should be able to fully rotate the key to the "off" position and withdraw it as normal.
If you try the above with the ignition at position 1 (steering lock released but dashboard doesn't light up) this won't work as the electrics wont be energised and they need to be for this to work.
To fix the fault I had to access the cable adjuster, which is easy enough. In front of the selector there should be a small cubby-hole. The rubber mat in this just lifts out and then the base needs to be (gently!) prised up at the front then pulled towards you to draw it out of the console. Be careful when doing this so as not to damage the clips at the front or the guide lugs at the back - you should be able to do this by hand, without tools. Once this is out the way, you should see the cable and the adjuster lock (a yellow plastic clip on the adjuster)
DISCLAIMER - I was unable to prise off the lock fully so I don't know if it is supposed to come off completely or just lift up a little to allow adjustment. I didn't want to force it in case I made things very much worse!
Anyway, after some faffing around I managed to get the cable to tweak up enough to pull the selector forward so that the release switch was pressed. I then pushed the lock back down and put everything back and now it works fine and it still selects the gears properly. It only took a TINY bit of adjustment to take up the slack so don't go mad and ALWAYS check that you can still select all the gears before putting everything back together.
Just as an aside, I was also trying to get the knob to come off (hurr-hurr) for better access but it was stuck fast. However this may have also pulled the selector assembly back into the right location but either way the problem has now been sorted.
If you're not comfortable with adjusting the cable yourself then by all means ask a pro but be sure to point out the issue as I've seen entire new selector mechanisms and replacement lock barrels suggested as a fix, which can be expensive, unnecessary and might not even fix the problem!
Hope this all helps!