I was assuming it came off the chainring and not the cog. I am guessing here but if your frame is super flexy than maybe it flexed enough to loosen the chain to pop off. But it seems to me that the chain had to be loosened in order to come off. If the rear wheel slipped in your drop outs you would have noticed that. If your chain line is off a hair that is fine. In your case the only way to get it right is to get a new BB or at least a new BB spindle in a shorter length.