Why were you sleep deprived? Were you involved in other tasks that kept your mood up thus fostering creativity? Was it actually that the task at hand was so enjoyable that you had already been putting extra time to get it done? Did you have deadlines?
I've noticed that you're creative when you end up putting more time and thought to any activity. You can fool yourself thinking that you are not getting ideas after sitting down for just 5 minutes to do a task. But if you are deliberate in your efforts (possibly due to the kind of work or imminent deadlines), then ideas will come to your mind.
But, I found that if I persisted with trying to create or refine the earlier idea, very often there was something good to be found, not always directly related. I might just be seeing a different part of the application code from a new perspective by trying to write a new feature using the same libraries, and go in and get a gain where they're used elsewhere.
I seem to remember Olivia Laing touching on the hangover--> creativity phenomenon a bit in her book The Trip to Echo Spring: On Writers and Drinking. I suspect most of the people she writes about in that book (e.g. Hemingway, Fitzgerald, Dylan Thomas, Tennessee Williams) were chronically sleep deprived in addition to having drinking problems.
But I found hangovers equally assistive to quiet linear, procedural tasks, specifically reeling in telephone sales closes. I would say there's a combination of narrowed creativity, to talk around any already understood but surmountable objections, and the step by step almost rote procedure of confirming the customer's interests and the concessions where you have applied any, terms, and the okay, this is what I need you to do to deliver you x today.
Admittedly sometimes I found a excess of creativity arising from gallows humour, particularly if my customer happened to be likewise hungover - I would tease my favourite customers that they were getting my call in the morning, regardless of whether they signed by the end of a junket we held the night or weekend before. Colleagues kept immense Outlook calendars of sporting fixtures and rolled a feed individually for the latest on their customer's team affiliations.
I'm curious how many people on HN have been in corporate sales ever. Personally, I really enjoyed the experience. But I wasn't stuck with it, I was seconded to make sure that technical arguments actually were supported by the operations and development guys. I reckon if sales functions could level with the experience of the dev/ops teans, prior to calling, close ratios would be up all around. That's what my job was, basically.
Oddly enough, for people with ADHD, a poor sleeping schedule might actually help (in the short term) with concentration issues!
I found in university, strangely through sheer accident, (during the first two years of my PhD program in physics) that I performed best on my final exams and written qualifiers with three hours of sleep.
I would sleep 3 hours after late-night study, drink a lot of coffee, and then be able to hyper-focus like a felon on a three-hour-long exam.
Eg, I remember doing 3 qualifiers on Mon, Wed, and Fri in one week, so a small nap and then back to studying for the next one.
Not a fun week, that.
I wonder if others feel their creativity improved on sleep deprived days? I have never read anything about that.