That's right. The correct technique for pulling an all-nighter is to realize that you're making a terrible mistake and not to do it anymore. Your brain really doesn't work very well without sleep. You may learn to pretend that it does, but that's not helpful.
Having said that, back when I didn't understand this I did figure out that it was a waste of time to stay up literally all night. At 3am or 4am you should go to sleep for two or three hours.
Actually, tiredness can attenuate some AD(H)D symptoms. I sometimes used to procrastinate until the last minute, then put in an incredibly productive night/morning to wrap up a project. And I cranked out some pretty good stuff.
But, I was young, then, and those projects were relatively limited in scope. I didn't know at the time that ADD existed; this was just the way I'd found to get such things done. (And I hated all the fear and dread it put me through.)
So, it may not be an optimal approach, but in some circumstances, the all-nighter can perhaps be enabling.
I don't have a reference at hand, but I recall reading somewhere that the tiredness attenuates some of the distractibility. Perhaps the mind is a bit less "agile"; it therefore foregos so readily jumping from topic to topic.
There is the counterpoint of hyperfocus. Something that is intensely interesting -- whether due to the topic itself or consuming pressure to get it done (NOW!) -- also lessens distractibility.
Having said that, back when I didn't understand this I did figure out that it was a waste of time to stay up literally all night. At 3am or 4am you should go to sleep for two or three hours.