You should never force yourself to vomit after eating or at any other time. I am concerned by your post and think that it would be appropriate for you to seek medical attention to help develop a healthier approach to your diet.
You shouldn't be vomiting it up at all.
If you have eaten an excessive number of calories then cutting back the number of calories you consume for a short period could be a good idea. This is advice I was given by the doctor on the emotional eating expert forum.
Exercise is also a good way to compensate for excess calories.
My advice would be to talk to your doctor or to speak with a psychotherapist. I don't think eating the cookie was as significant as your perception of food and body image, etc.
I would talk to a professional and let them decide whether the behavior is binge eating and/ or part of an eating disorder.