How long would a cruising aircraft take to crash if everyone spontaneously vanished?
There is a far more important question (and the real deciding factor) 

How much fuel is on board?

If left unattended a plane will fly until it runs out of gas quite literally, the more gas in the tanks the longer you have. This has happened on occasion before. The Helios Airways Flight 522 is about as close as you can get to this hypothetical situation in real life. The plane may travel farther (since its lighter) but it will go until its out of gas. The same thing applies to smaller GA planes as well. 

This is all of course assuming that the plane is not intercepted before running out of gas. Helios 522 was intercepted by F-16's before it crashed and they visually established that the crew was incapacitated (although a flight attendant tried to save the plane). I don't know what the procedure is for interceptions like this but if the plane were headed for a highly populated area they may not let it run out of fuel.