As previous posters have mentioned, it is all about moderation.
Remember, weight loss is about eating less and moving more. Although it's better to eat nutritious foods to let your body get as much as it can out of what you are putting into it, you can occassionally have a treat in moderation.
Here are a few suggestions that keep me on track:
1. Dish out treats in individual serving sizes and freeze them. When you NEED a treat, take one out of the freezer and let it thaw. I find this discourages me from having more than one serving at a time and yet I still feel satisfied.
2. If you do have a bad day, just exercise a little more. For example, yesterday I was hungry and stuck in school with just a vending machine, so I ate a 3 Musketeer's Bar and some yogurt pretzels. To make up for this, I limited my dinner portions and did a second workout on the treadmill. This morning, I didn't lose anything, but I didn't gain anything either.
3. Be creative! Find healthy recipes for "treats." For example, today I'm making some banana bread, but I'm using whole wheat flour, smart balance instead of butter, skim milk and splenda instead of sugar. Then I'm again freezing them into individual servings so I do not over eat. I've found that creative cooking is one of the best ways to keep yourself on track.
Hope this helps. Remember that we are all on this journey together.

Don't give up!