sleep deprivation has shown many times that it "delays" symptoms of depression and those who are sleep deprived are happier for that deprivation term. i'm guessing the euphoria has to do with elevated levels of seratonin and all that. as
>>12905960 said, adrenaline kicks in and keeps you going. it was really scary to stay up to do work and have trouble falling asleep even when deprived; don't do it often and purposely, if you're already bonkers it'll make you worse off.