A little cookie, coffee or snack break will divide the 12 hour night into easy to handle segments. You need to find something that drives you on. Dressing into your pajamas and slippers will get your mind more on your bed and what you are missing than on your studies. Try to stay out of your room, and preferably in an uncomfortable chair that will drive you on to finishing your assignment quicker. Don't Stress Out Cramming for a test or paper is part of College life.
Every student goes through it sooner or later.
Instead of thinking of it as a chore, consider it an adventure into unto territory. Chances are, you have had all-nighters before at someone house. Just think of this as a good time getting something done. Stressing out and thinking that you will never get it done will only waste precious seconds. Relax, take a deep breath, and dive right in.