He really should have known better. Saying that he didn't like Princess Luna, even if she could no longer hear him, would have probably lost him the sympathy of many ponies in Canterlot, and it had been perhaps a rash decision for an expert diplomat like him. Still, the damage would not have been irreparable. But how was he supposed to know that she was still alive? Clearly, jumping out of the window had been the only logical course of action after that.