The Greater Doppelganger, Monsters of Faerûn (p. 35)
Greater doppelgangers are the paranoid’s ultimate nightmare: a monster who can eat your best friend’s brain and then not only look like him, but talk like him, have all of his memories, and wield all of his abilities. It possessed the Alter Self ability to turn into any small or medium sized creature indefinitely and by eating the brain of any medium-size or smaller being (RAW suggests that this is seperate from Alter Self and can be used to turn smaller than Small) and take on its identity alongside its mind, memories, personality and alignment. This suggests being able to cast spells as an arcane caster, but is not mentioned by name. And be careful with plotting against it: it has a continuous Detect Thoughts going on (DC 15). And its social skills are rather good (Disguise +27! Bluff +17!) so your players cannot rely on rolling Sense Motive all the time.
However, it comes with its weaknesses. Casting cleric spells above level 1, a paladin's special abilities or other deity-granted things are not possible because the gods aren't stupid. Also note that Greater Doppelganger cannot hold more than three personalities this way without a DC 16 Will save, and if it acts counter to its alignment it snaps back into its base form for 1d10 rounds. And when it comes down to it the being only has 49 HP on an AC of 17, so for a CR 12 creature it is not very tough.
How to build The Thing
As a core the Greater Doppelganger works, but you might want to make it more, well, alien. I would suggest taking a look at the Warshaper Prestige Class (Complete Warrior, p. 90). Because of its poor wording the feature Morphic Weapons allows you to grow as many appendages as you want without any limit, so if you want to grow tentacles or claws to drag the thing along, you can do that. Or you can give it a bite attack if you want to re-enact that one scene (you know the one) from the movie. Though making this something quicker than a Move Action is advised. Morphic Immunity works as well because it fits the theme of being some alien being with unnatural physiology.
Of course, the end result is a humanoid being. If you want to have something a lot more alien than that take a look at the Phasm, which normally looks like a mass of colored goop. It is a shapeshifter too with more HD, HP, saves and good abilities, though it lacks the more nuanced abilites of the Greater Doppelganger. So if you're content with it you can look at the Greater Doppelganger, but if not you can consider pilfering some of its abilities and slapping it onto the Phasm. And don't forget some kind of way to deal with corpses, because the PCs stumbling upon them will impede the thing's plans.