Don't forget: there's always Ancienter Evil.
That answer though is probably the worst I could give :\
Far too many try to make monsters tougher encounters simply by making the monster tougher. In epic level campaigns, the PC's power increases drasically more rapidly than it did 1-20.
Also don't forget that your Ancient Evil is Ancient for a reason, and it most likely wasn't brute strength. Cunning, paranoia, intimidation, and overall smartniss tend to be more effective tools in the long run. Not to mention a good strategy can make a monster more deadly than one with an extra 10-15 HD that deals more damage per round but stands in the middle of a mongolian cluster f&%# getting pummeled.
Pit Fiends and Dragons that have been around since the dawn of time will likely have nigh unbeatable defenses in place after a few thousand years of upstart adventuring groups deciding it'd be fun to go 'wake him up and kill him'.
The Ancient part of your antagonists means they've had lots and lots of time to design their defenses. The Evil part means they've used that time to design those defenses with malice and lethality that is meant to overwhelm opponents, not dissuade them or give them a run for their money. I'll be that dragon got real pissed 3000 years ago when the elf he had sent packing 3500 years ago came back and stole his prized possession and killed his mate in the proccess. Pissed enough to make sure it
never happens again?
Any self-respecting Ancient Evil who has had its own spot on the map for a few hundred years will have a room full to the top with hundreds of animated skeletons (enough crits will eventually get someone), or a hallway containing a dozen iron golems (both dirt cheap and timeless guardians after the golems' initial cost is shelled out).
The countryside for miles around might be populated wholly by the Evil's slaves, or might be a wasteland of bubbling acidic mud.
The fortress itself would aslo be designed to allow the Ancient Evil to use it's mobility and special abilities to full advantage.
I had a group a few years back, started at lvl 1 and hit 23 before the epic level handbook was released. Being an evil group that had just built their portablefort, they decided they needed a truly intimidating keystone for their front gate and went after a 56 HD silver dragon with a vengeance. As you relayed, had the dragon fought them head on, the combat would have been over in 18 seconds or less, game-time.
With just 2 little tricks this dragon forced the party of 4 (antipaladin, wizard, cleric, and rogue/ranger) to expend roughly 60% of the cleric's spell slots, a dozen charges off various wands/scrolls/staves, 2 wishes, and a quick fight for their trophy became an epic clash of titans (that fight is one of their favorite stories to tell when they meet new gamers-one of mine too

)
The more effective of the two tricks was a simple illusion. From far off, as the party flew toward the dragon's lair, they saw it dozing on the sunny side of a mountain. Needless to say, they devised their plan as soon as they saw the surroundings, and opened fire with everything they had on the sleeping dragon. 2 rounds later, the real dragon dropped from the cloud cover and returned the favor, first pouncing on the wizard and planting him 30 feet in the solid rock, then crippling the party's inflatable (summoned) ground forces
with a rock slide and dispelling the cleric's fly spell before heading off to its lair to prepare for the true battle.