If you learn from it, then in some ways it's been a positive experience.
Firstly, you haven't undone anything. It's not great and it obviously won't help your weight loss, but if you hadn't been good for the rest of the time then it would've been worse. Think of your weight loss as climbing a hill. If you stumble and fall down a couple of steps, you haven't ended up back at the bottom, and to just say 'oh well sod it then' and go back down is cheating yourself. You look for what you stumbled on, and carry on upwards while using your experience to avoid falling again.
Think about what triggered the binge, how you felt during and after, what you were trying to achieve and possible ways you can achieve that feeling without turning to food.
Using food as a coping mechanism is pretty socially acceptable, so it's very common. Once you've learned that, it's very hard to unlearn but there are other ways. I have completely broken my emotional eating cycle (unfortunately for me that meant I got complacent and let lazy habits creep back in!) and when I feel stressed now I never think about what I can eat to feel better. I have a hot bath or go for a walk, so changing your habits IS doable.
It's really important that you don't beat yourself up, because I think self loathing is a fairly big reason a lot of us put on weight in the first place.
What's important is learning to manage your weight, not just the numbers on the scales. Slip ups are part and parcel of that learning process.