It's been long enough that I don't remember what I did to get it shut off (maybe I toggled a circuit breaker?), but when I got back to base, I made a note in the airplane log about the problem and also left a note for my instructor, who was out that day.
When I came in for my next lesson, instructor mentioned that the next person to use the airplane, also a student on a solo cross-country, got stranded 100 miles away because when the engine wouldn't shut off, he panicked and pulled the throttle hard enough to rip the cable through the firewall. Airplane had to be put on a flatbed to get it back home.
Guess he didn't see my note!
Usually there was a fuel disconnect along with the throttle that would eventually starve the engine.
I just tapped the relay with a wrench and it un-stuck and turned off.
Funny enough that was almost 5 years ago, and it hasn't done it once since in more than 80,000 miles of driving. Not in -35C, not in +45C. Odd little relay.