A study from the University of Waterloo published in the journal Personality and Individual Differences shows that being in a bad mood can actually be a good thing. Specifically, a bad mood can boost "executive function." Executive function might sound like a black-tie affair for high rollers (forgive me), but it's actually, to quote the National Institute of Health, the ability to "mentally play with ideas" and what WebMD calls "the ability to get things done."
Ninety-six university students took part in the study, completing a series of tests for college credit. The tests included five memory and reaction-time assessment tests, and three questionnaires. Two of the questionnaires were used to assess the bad mood itself and the personality type of the test taker respectively, while the last was for demographic information. For what it's worth, most of the test takers were in their late teens or early 20s.
The study found that highly reactive individuals did better on executive function tasks while being in a bad mood. The study classifies these highly reactive individuals as "those who have rapid, intense, and enduring emotional responses". A perhaps less-PC classification might be "generally moody people."
But why is this? Negative moods promote an analytical thinking style that's very well suited to problem-solving. Psychology professor at the University of Waterloo Tara McAuley posits that these highly reactive people are used to experiencing bad moods and therefore aren't thrown off by them. On the flipside of that, more mellow-headed people are distracted by bad moods because they aren't used to the cloud of negativity hanging over them (must be nice!); they actually performed worse in the series of tests. They did, however, perform better at the memory portion of the series of tests.
Basically, the "moody people" are marginally but detectably better at self-control. Executive functions, as described by Adele Diamond in her landmark 2013 paper on the subject, are "effortful; [as] it is easier to continue doing what you have been doing than to change, it is easier to give into temptation than to resist it, and it is easier to go on 'automatic pilot' than to consider what to do next." People in good moods, one can read from that, are more likely to go on autopilot. (FWIW, Adele Diamond is an absolute wizard in the field of neuroscience and executive functions, as she is the Canada Research Chair Professor of Developmental Cognitive Neuroscience at the University of British Columbia in Vancouver — which is a fantastic job title but also means she has to buy very long business cards.)
A caveat to these findings: "a bad mood may help with some executive skills—but only for people who are more emotionally reactive." Which means that you can't just take this study and print it out and post it in the company break room and assume you can get away with being a total grouch. Just because you're in a bad mood doesn't mean that you'll do better at work—it's more that if you're a grumpy person in general then a bad mood won't throw you.