Distractions are generally viewed in a negative light especially on studies that deal with efficiency and effectiveness. However they can be beneficial in brainstorming and creative thinking.

The journal Neuropsychologia (Elsevier) published recently the paper “Flexible or leaky attention in creative people? Distinct patterns of attention for different types of creative thinking” by Zabelina, Beeman and Saporta. The authors found that individuals with higher creativity are also those who tend to be easier and more distracted.
…high creative achievement was related to quicker responses to the congruent than to the incongruent stimuli, suggesting that real-world creative achievement is indeed associated with leaky attention, whereas standard laboratory tests of divergent thinking are not.
Such findings agree with older research where distractions were considered beneficial and even necessary for out-of-the-box thinking. For example remember the Scientific American article from 2012, “The Inspiration Paradox: Your Best Creative Time Is Not When You Think“.
Insight problems involve thinking outside the box. This is where susceptibility to “distraction” can be of benefit. At off-peak times we are less focused, and may consider a broader range of information. This wider scope gives us access to more alternatives and diverse interpretations, thus fostering innovation and insight.
So the rule of thumb is this: when you need to brainstorm or think in a creative way then let distractions in, they will help you re-set and think the problem in a new light. In that case distractions work for you! So take a break, go for a walk, talk to a friend or play your banjo for a while. When you need to do analytical work then stay focused on the task at hand. Now it is the time to find ways to implement all those great ideas of yours!
A great article synthesizing the above discussion can be found on 99u.