I've gotten 90% of my collection from thrift stores and flea markets, which means I have dealt with some NASTY hair. What I usually do is
-brush to the best of my ability
-wet hair with warm (not hot) water
-shampoo (I use Garnier for color-treated hair)
-comb shampoo through gently
-leave the shampoo for about 1 min
-rinse
-condition (again, Garnier for color-treated hair)
-comb conditioner through gently
-leave the conditioner for 5-20 mins (depends how bad)
-rinse very, very thoroughly... there should be no soapy bubbles left in the sink
That's worked for all of my girls so far... and I spent over 3 hours combing out the hair on my 9" Styling Cheerilee, now she has beautiful curls! I have never used any heating products (straighteners, hot rollers) on my ponies so I cannot say if that works- I am too chicken to try. I use sponge curlers, and for straightening hair I just let them dry with their hair laid out flat on the shower floor.