put on a shitload of conditioner -- when i had ass-length hair i used the rinse-out stuff and just didnt rinse it out when i need a super-strength detangler. try to separate out a small section of the gnarly hair from the big ball of tangle, and detangle that small section. set untangled hair aside and repeat until you're done.

also, once it's done, i HIGHLY suggest keeping your hair in a braid while you sleep. it'll keep you from ending up in the same tangly place again.