I used to enjoy working until about 3AM, and sleeping til noon. I definitely got the majority of my core productive work done in the hours between midnight and 3.
As I get older, it becomes less and less feasible though. I'm usually pretty zonked by midnight now, so I do most of my productive work in the evening.