We're so hard on ourselves sometimes, aren't we?!
What you're going through is so normal. It's why most of us are here on SparkPeople. If it were easy to keep ourselves motivated, there would be no need for sites like this! You need to accept that you're human. That doesn't mean that you just continue deviating from your plan, but it does mean forgiving yourself and moving on.
One of the things I've found very important is to really examine what I want and why. Writing down, and revisiting often, lists of what I want (not just weight or health-related), why I want the things I want, the specific benefits of reaching my goals, and other such lists, help me to focus myself and re-affirm my commitment to my dreams and myself. I suggest you make your own lists (I know The Spark book has assignments that help you examine such things - it, and the book "Full-Filled" by Renee Stephens, can really help boost your ability to stick to your guns!
Make yourself a priority. Don't let yourself forget that you want to be healthy and happy. Remind yourself that, especially when it comes to eating, you have a choice. Remember: Don't trade what you want most for what you want at the moment. That mantra has pulled me through many times!