First of all...
please don't be down on yourself!
We are all human and most of us have slipped our tracks, often turning into major derailments. I sure have (even without pending surgery stressing me out)! I have been thrown off track for weeks at a time. I have learned from those experiences and it doesn't happen very often any more, but the last time was just a few weeks ago and I was happy that I was back on plan within a couple of days.
I do think there is a physical/physiological component to the restriction/craving thing, and a small misstep tends to snowball. But you can overcome it and get back on plan. Learn from what happened (maybe you learned not to over push yourself, or to avoid certain trigger foods entirely), and move forward from here. The last ten days don't erase all the progress you've made. And even if it did (in terms of weight), as long as you learn something and can build on that in the future, you have made progress towards eventual success.
Maybe some other folks can recommend useful books, but I think there is plenty of support to be found on this site.