I was having trouble with the headphones not being a clear enough signal so I took a 3'x4' black foam posterboard and made a cubicle door. It caused a stir but mostly just in the people who liked to come by and ask me if I'd opened the cat gif they'd just emailed. Having the door closed is a nice clear signal and so far it's worked fine, for exactly your reasons. I can now trust that I won't be interrupted and I can relax to focus.
It seems like the problems expressed by you and the parent comments really come down to the unsuitability of open plan offices for development work that seem to have become popular in many startup environments. Giving people access to offices with doors that close would elimanate an entire class of issues (and admittedly introduce some more, but I couldn't see anything being more destructive than continuous streams of interruptions)
I don't agree, actually. Office doors wouldn't help if people just opened them whenever they wanted. The reason doors can be more effective is because they're a more common sign of that request for uninterrupted thought, but that can be accomplished on open plan offices as well, if you have a policy defining those signals. Open plan offices may be worse on a general noise level, but that's a different issue.