Instead of proposing a Great Old One, Infernal, Abyssal, or Extraplanar entity; I'll just suggest the Ravener from the Pathfinder Bestiary 2, pages 230 - 231. CR22 Red Wyrm Ravener, 337 HP. A Gargantuan Undead Red Dragon, who casts as a 20th Level Sorcerer. It knows three 9th Level, three 8th Level, three 7th Level, and three 6th Level Spells. It possesses Spell Like Abilities, as a 27th Level Sorcerer. Its Breath Weapon does 22d10 Fire Damage, Plus 2 Negative Levels. It can Melt Stone, and Consume Souls.
Nice.....
So a super dracolich? 3e D&D is pretty much made of this at the higher end. Or what the dragon god Falzure from the 2nd D&D movie should have been.
(http://1.bp.blogspot.com/_LGkxTF2xWxs/TIktS0GGYOI/AAAAAAAAAtI/1WanSGFbL8c/s1600/Borys.jpg)
30th level Defiler/Psionicist with thousands of years of gathering powerful artifacts and building a near-impregnable city-state to draw on. Has a circle of high level liches and an elite guard to serve him.
He casts a spell and people die from the defiling magic, before even considering what 10th level craziness he's casting.
D&D 3.5:
That Crab, that goddamned crab.
http://archive.wizards.com/default.asp?x=dnd/fw/20040221a
You may not intend for this to be the party's final battle, but at level 3 it probably will be.
Morgan Le Fay.
The Snake Creature from Obscene Serpent Religion 2.
It doesn't do a lot of damage. It does travel back in time the very instant you do damage to it, and fucks with your PC's ancestry. Twelve possibilities, ranging from "you never existed" to "the snake creature is now your mother." Having to reroll some or all of your ability scores is likely, having to reroll them all until they're worse than what you started with is a possibility. Lose all your experience points and your character class? Can happen.