I had a similar issue back last spring. The 2 snap on ball connectors at the tranny end of the cables can sometimes loosen or pop clean off but another issue is where the cable sleeve is fixed to the tranny housing before the cables exit to the two shift levers. This mounting sometimes pops off and makes the gears not engage but can pop back on after flogging the shifter.
When it happened to me I drove, in 3rd gear, to my local indie and he diagnosed it on the spot. Up on the lift he showed me the issue and did a quick snap back in and ensured it was secure.
I haven't had an issue since but I did get new improved cable security clips from TUNERS here:
TRS Shift Cable Security Clips – 986 Boxster | TUNERS MALL (TM) | PORSCHE(R) PARTS & MOTORSPORTS EQUIPMENT
and along with new shifter end ball connectors from the dealership the whole shifter feels tighter and more precise.