I used to "lose it" 2 or three times a month. My nutritionist suggested journaling "what were you feeling, how did you handle it, what changes can you do next time".
That really helped me keep it from being a habbit.
sorry about the headache, by the way. too much sugar?
Good luck tomorrow.