The emotional blocks to productivity are a very real phenomenon. I've only ever done this once, but I pushed through a really annoying emberjs refactor through Ballmer Peaking overnight.
I completely agree. When I'm unhappy with my productivity, part of my self-assessment involves taking a careful look at my emotional state and seeing if there's anything there that isn't compatible with the calm/attentive/enthusiastic/alert combination where I do my best work. And if I turn something up, I either switch tasks, take some time off, or try to resolve the impediment one way or another.