If knowledge is on the team because the company is stable, rewrite. 37 signals is a clear example of this.
If the knowledge is in the code, because multiple people or teams worked on the code base over the past few years, refactor. A rewrite will be the recipe for disaster.
I never found an exception to this rule.