Don't do what I did for the first few weeks: Break things. Your phone, your iPod, a coffee mug, your mouse, your keyboard, or anything breakable nearby. Also, resist the temptation to scream at coworkers who dare bother you with "questions" and, like, other "work" communication.
Sigh... happy place happy place...
ANYway... all of the advice here has been good: Just standing up from your chair, or thinking about something else for a bit (PoA), doing some minor exercise like taking a walk, or just visiting (read: annoying) coworkers tends to work for me with the minor "This really should work... Why the $#@* isn't it?" kinds of problems. Usually it's only a minute or two after coming back to the problem it's time for "*facepalm* Way to go, dumb***, that was easy."
Also, as you already mentioned, I find talking the logic out to somebody is helpful, but usually only for the more major "Uh... How the hell am I gonna make
that happen?" problems. (Edit: And if it's a
really bad "Holy ****, WTF am I gonna do?" situation, bust out the dry erase board and diagram it out... I've drawn some things that probably make people think of
this experiment, but it can really help.)
Whatever you do, though, it does get easier with time. My work habits are much different today than they were when I was a smoker: It used to be that I'd do 1-2 hours at a stretch of real intense, real focused work (with the occasional PoA or other dalliance), then a smoke break, then 1-2 hours of real intense, real focused work... lather, rinse, repeat. And there'd be the occasional, "Okay, this isn't going well... time out" kinds of smoke breaks. That usually resulted in a pretty predictable work day for me; 5-7 or so of the above cycles in the office, then another 1 or 2 at home at night. Now it's much more stretched out and lower-intensity... The cycles last much longer, but I don't really think I work as "hard" as before. I'm more susceptible to getting distracted by PoA or something else now, so it's more like two separate 4 to 5 hour low-intensity periods at work (punctuated by lunch), then the same hour or two of work at home at night. I also find I'm much more productive later in the day than I used to be, and that sometimes that evening hour or two gets spent in the office.
Anyway, YMMV.