STEP 0: Don't touch anything.
STEP 1: Find the transponder. It looks like one of these: http://www.free-online-private-pilot-ground-school.com/image... or http://www.funkwerk-usa.com/funkwerk/trt800h/trt800h-lg.jpg
STEP 2: Set it to 7700 (emergency) or 7500 (hijacking)
STEP 3: Put on the pilots headset and wait, someone will start talking to you and explain how to respond.
STEP 4: If you don't hear anything for an extended period of time try to figure out why the radio doesn't work. Then start to panic and put into practice crazy things you read on the internet.
AVIATE: Keep the plane straight & Level.
NAVIGATE: Don't hit anything, turn to avoid any mountains etc, otherwise stay straight & level until ATC/Other pilot assistance directs you to the runway.
COMMUNICATE: Broadcasting MAYDAY on any common channel is a good first step. CTAF (Common Traffic Aerial Frequency) used by light VFR aircraft. ATC/Tower is also monitored. Most likely the current channel is good to start with.
DO NOT Squawk 7500 on the transponder unless a hostile action (hijacker etc.) caused the pilot to become disabled. Squawking 7500 results in armed fighter jets scrambled and SWAT teams meeting you on the runway. Squawking 7700 is the emergency code to use in case of a disabled pilot.
Aviate, Navigate, Communicate concept is drilled into every student pilot.
Someone who does not know how a plane works and does not have a conscious PIC shouldn't touch anything without direction from the ground unless a collision is imminent.
I assumed the (hijacking) and (emergency) labels were pretty obvious.
In a heavy aircarft, e.g. passenger airliner? Has this even happened?
I don't know if anything like that has ever happened in a heavy aircraft. However, commercial pilots have pretty big health requirements to make situations like that less likely.