You're doing the treasure generation right. Apart from a couple of details, the outcome you describe is actually not far off how the game is supposed to work.
The two things you may have done wrong are:
- treasure placement
- character level advancement
I'll take these one at a time.
1. Treasure Placement
One of the ways of limiting the treasure generated by the stock tables is placement of the treasure. The tables are tuned (heck, the whole game is) based on the idea that not every treasure (or secret, monster, etc.) will actually be found by the PCs during an adventure or dungeon. The tables generate more wealth and magic than necessary, so that when the PCs inevitably miss the secret doors that lead to treasure caches, avoid the monster that's too nasty to fight just now (and which is carrying some of that treasure), or just turn around and leave the dungeon before exploring much of it, they will still get something of value.
If you've made a linear dungeon, or one with with “secrets” that were easy or guaranteed to be found, or otherwise made the entire treasure generated easy to access, then the PCs are going to get lots of treasure. Finding all the treasure is fine sometimes because PCs do get lucky, but that averages out over time — however if every dungeon and adventure location is designed to be “cleared” with all monsters fought and all treasure found, you'll find that the PCs are getting way, way too much treasure.
So that's one thing that you might have done wrong, which may be giving the impression that the tables should be limited in some more obvious way. The tables aren't limited — but they are tuned to expect that the rest of the game's structures are being used more-or-less as designed, and this is one way that modern DMs often do AD&D dungeons “wrong”, due to modern D&D editions' expectations that if it was made, it must be encountered/found/fought or else it's wasted.
2. Character Level Advancement
XP awards are only given as a lump sum at the end of an adventure when the PCs return to distant safety — when they haul themselves and their treasure back to civilisation or their stronghold. This may seem like an unimportant point, but it matters for the next point.
Characters can't advance more than one level at a time.
When all the monsters (encountered) are slain, the treasure counted, and the magic items looted, they still don't get experience points. The DM tallies it all as the adventure progresses, but the DM doesn't award it yet. They still need to get themselves home before earning experience.
And when they do, they have to contend with the 1-level increase cap. In stock AD&D this limit is based on being able to train only a single level at a time, per the training rules (DMG, p. 86). In a game that is not using training times (which in my experience is not uncommon to do), the typical house rule used is that if a PC would earn enough XP to advance them more than one level, they earn instead enough to increase a single level, plus enough XP to put them 1 XP short of the next level. (This is the rule in original D&D and is similar to the rule in AD&D 2nd edition.) Either way, a PC can't advance two levels at once.
In Conclusion
Taken together these two things makes a 5,000 XP windfall from finding a Mirror of Mental Prowess unlikely to mess up the game.
First, they're not supposed to be guaranteed to find it, so it shouldn't happen every adventure, even when your dice have amazing luck and you're generating Mirrors and Rings of Wishes left and right. Striking it rich like this is something to be expected on occasion, but averages out — some adventures have poor luck and never find that hidden room with the Ring. Some adventure will end with disappointing treasure hauls. This is a normal part of the ebb and flow of the luck of an adventurer's life.
Limiting level advancement to one at a time (either by training or “extra” XP being lost) is an important rule, and ensures the occasional big bump in treasure found doesn't foul up character advancement. It has a bunch of other purposes that are beyond the scope of this Q&A, but it's an important feature of the game, let us just say. In this case, it would have meant that everyone would have advanced to 2nd level, and the ranger would have had enough XP to nearly at 3rd, but everyone (ranger included) would have had to go through an entire other dangerous, life-risking adventure before being allowed to get up to 3rd level.
Assuming that the game isn't a Monty Haul campaign with all treasure generated just obvious for the taking, this would have been one nice payday, but not a DMing tragedy. After all, the life of an AD&D adventurer is dangerous and each level brings very few real increases in power. They need those levels that they earn, and even then may lose their lives in a random foulup an adventure or two later.
What do you do now?
You don't take anything away. So yeah, the ranger is a bit higher level than intended, but that's not going to break anything if it's allowed to ride just this once.
What you do need to do is inform the players that you messed up the XP awarding a little bit, and explain how the level-up limit is there. If you assigned XP on-the-fly during the adventure, also explain that you won't be doing that anymore, and they'll earn it as a lump post-adventure.
Do these things, and the little bit of turbulence from doing it a bit wrong just this once won't have any significant negative impact on the rest of the campaign.