Done it multiple times at Dav's Hope.
Usually by rushing the circuit just a little too fast and / or getting lazy with the boost button.
Beyond wiggling the steering, throttle and thrust, and without a fellow commander nearby to nudge you free, the only option I found was to self destruct.
There are several options aside from self destruct, as suggested Flthymick420 you can try re-logging, the other option is to log off and log back into the non-horizons version (if you are on PC) and that will put you in your ship in orbit.
You could try to give a shout to the Hull Seals (or Fuel Rats). Maybe a kind CMDR with a force shell cannon is in the area.
I already do it, but my vehicle doesn't change place -_-Log out and back in. that will unstuck you