I'm going a slightly different direction than the other answers here: Kowloon already shows us that it was technologically possible years ago, so I'm not going to focus on what technology is there so much as how your specific scenario came to be.
The Trading Outpost that grew up
You want a limited amount of space, but willingness to trade . . . this sounds to me like it started as a trading outpost.
An example of how this could occur:
In its early days, the outpost was a small territory near the trade routes of several powerful nations that were constantly warring with each other, but any 2 could easily defeat one of the others. Because the territory was so small, and had cost so many lives, the larger nations mutually agreed to its independence. After some time, this independence meant that even citizens of nations at war with each other could do trade here, and this caused a small merchant class to grow into a wealthy merchant class.
Over the years, these merchants built up the natural trade routes to be much better than the surrounding trading options, causing more money to flow through their tiny land, attracting more and more people until eventually they had an enormous population relative to their land mass.
Reasons for the small territory:
Mountain pass: The mountains severely restrict the size of the territory, but since multiple mountain passes cross here, people built it up.
Island: A remote island nearly equidistant to several world powers. The island was a natural place for a trade outpost
Pirates: People like to prey on trade, so trade was restricted to small easily defensible positions.
Dangerous animals: Lions and Elephants are in the territory surrounding this oasis, causing people to stay close together.
Zombies: You never said this had to be completely realistic!
Explicit Answers to the question
Avoiding crime: Wealthy merchants have a strong motivation to encourage trade and prevent crime. Their private police forces would naturally be very unobtrusive, yet quick to react to problems . . . or they would be out of jobs!
Avoiding social unrest: Many wealthy merchants live in the same area, but can't expand too terribly much because there simply isn't the room. They will find ways to be a bit showy about their wealth. (Perhaps decorating their homes with gold or jewels.) (Un)Fortunately (depending on your perspective) there isn't the room to block off roads for the wealthy or powerful, so any person can easily run into anyone else. Therefore politeness and generosity to everyone is probably a trait of this community.
Logistics: This may be a cop out, but . . . A wealthy society that has had years to work out how to handle food, drink and waste processing has indubitably come up with various solutions to this that are far better than I can in a few minutes. :) We know that Kowloon was able to do it on a shoestring budget. Wealthy merchants can definitely accomplish this on their budgets. I would imagine the interior of this territory feels more like a bustling mall than anything else you would quickly think of.