We've all been at the losing end of the "it was all a dream" plot twist before. But where did this trope come from?