There is one reason an area will look clean and dry dirty/stained
Wicking
The fiber dries from the tips to the roots and as this happens, the dry area wicks liquid up the fiber
The two possible solutions are:
1. Completely clean the source of the stain, get every little bit of it out
2. Clean as thoroughly as you can until no stain is visible on the surface and then dry the area rapidly to prevent wicking
If you are removing the carpet, you could power wash it or use a powerful Rug Doctor type hot water extractor
Make sure you address the back side of the carpet and any underlayment to prevent the stain returning
Here is a good video that helped me gain a better understanding of stains and how to properly remove them:
[ame="http://m.youtube.com/watch?v=HweQSpYdhRs"]Carpet and Upholstery Stain Removal with Jason Rose at Meguiar's - YouTube[/video]