Random Encounters with High Level NPCs

Encounters in published adventures tend to be scaled to the level of the characters the adventure was created for. If it’s an adventure for levels 1-3 you would typically not expect to encounter 10th level monsters, as there is a very real possibility they will quickly overwhelm foolhardy adventures and end up killing the party (and possibly the campaign). This can work well for adventures set in specific locations - where the woods have low level monsters, the swamps have mid level monsters, and the mountains have high level monsters (as an example).

What do you do though if you want to set an entire campaign in the same location, such as a city. Do you keep the monsters and NPCs the players are interacting with scaled to their level? Do you try and keep the adventure tied to different areas of the city, where the docks are low-level, the thieves district is mid-level, and the magic district is high-level? Or do you let the players run into encounters that are far outside of what they would normally be able to handle?

Looking again at the City encounter tables in the AD&D DMG there is a wide range of things the party could meet, even taking all the supernatural creatures out of the mix. Walking through the town they could run into a handful of 0-level commoners or guards. On the other hand they could meet a group of aggressive mid-level fighters. Unlucky (and unwise) players could even find themselves on the bad side of a high level wizard!

While the idea of letting players run into this range of adversaries is appealing to me, I wonder if other people have had success with this? How did you make players aware of the risk involved in the average man they meet with a sword when they could be a 0-level person, or 10th level fighter? If they are not dressed like a Lord, do not have obvious magic items, and are hanging around in a common sort of place do you give any hints to ensure the players don't unwittingly bite off more than they can chew?