Eat one’s hat

To do something extraordinary or special if something that you do not think will happen actually happens (this is always used with and is used when you are quite certain that something will happen and if it does not happen then you will do something extraordinary or special – like eating your hat).

I do not think that my friend will arrive here on time. If my friend does arrive here on time I will eat my hat.