Maintaining the right balance between power users and newbies. In most failed communities, the balance tilts one way or the other. Some of the communities become too egalitarian and let the crowds decide everything. That is the recipe for evaporative cooling. The crowd-pullers will drown the sane voices in such a setup.
Building a strong group of fair moderators
In modern democracies, you have one branch that is directly controlled by the people (legislature), one branch that is indirectly controlled by the people (executive), but the third pillar is completely out of bounds of the people (judiciary). In the US supreme court, the judges are appointed for life and made by the President+Senate. Thus, these judges can avoid being swayed by the immediate interests of the masses.
In the same way, online communities must avoid the temptation for the crowds to decide everything and build a fair, stable "judiciary" in the form of moderation. The moderation group should have little churn and be able to implement the rules in a very consistent way. The moderation group should be comprised of senior members of the community, who have long-term vested interests and be able to get the respect of the community.
Wikipedia has faced a lot of evaporative cooling over the years, as their moderation was often inconsistent and run by 12-year olds who have little respect from many other senior members of the community.
Real world has hierarchies. However, in the online world we try to go for a pancake. There is an anathema against hierarchies. Although inflexible hierarchies can produce problems of their own, in a pancake there is no incentive for people to build reputations. If the opinions of the sanest expert is the same as the opinion of an ignoramus, the experts will leave. It is these experts, you would never like to lose. Even at the expense of 100 newbies, you should try to preserve the expert. If there are enough experts, the newbies will always come.
Fight the trolls immediately
It takes only a few trolls to completely subvert a sane community. Even the sanest members can be angered and will be forced to get the worst out of him/her. This means, trolls must be be cleared off the group, immediately before they set the cat among the pigeons. The tolerance for a given troll should again be dependent on where they are in the hierarchy.