I mean should I always split the sentence into two ("And can you imagine? He escaped through the window!") or I can just get away with one long sentence without a question mark at all (something like "And can you just imagine - he escaped through the window!"). What punctuation would be correct in such cases?
You can treat them as separate sentences, in which case all the usual rules of sentences apply; in this case, terminate the first with a question mark and start the second with a capital letter.
Alternatively you could treat them as clauses, if you regard "Can you imagine" as an emphasis marker. In that case you would join them with a comma, since they are part of one sentence, and don't put a question mark in at all. I'm not sure whether that's a grammatically correct thing to do, but it does often reflect the flow of speech more accurately.
The dash (or em dash) is used to introduce an abrupt break in thought, a reversal of meaning, or a summary statement following a list.
"What did you intend by — but I forget my manners, please do come in."
"There is no way to do what you described — oh, wait, I think I see a way!"
"Rats in the basement, silverfish in the bathroom, cockroaches everywhere — there is no end to the vermin you will encounter if you rent that apartment."
Since your two sentences are related and flow together, splitting them with the question mark instead of the dash feels better to me.
As Robusto said, a dash wouldn't work, but I could make a case for either a question mark, a comma, or a colon.
Can you imagine? He escaped through the window!
Can you imagine: he escaped through the window!
Can you imagine, he escaped through the window!
The different punctuation marks imply slightly different pauses/inflections. Also, the comma is probably ok for informal use, but I'd avoid it for anything formal, because it could be interpreted as a comma splice. (Not that I can come up with a formal situation where I'd use something like "Can you imagine"...)