While this is often said, it is often said in context -- "except perhaps a mortgage on a first home". A lot of that has to do with the ability to deduct mortgage interest. Another consideration is whether you need the money more liquid, in case of a job loss.Pay off all debt first.
While there have been times, in the past, when it was right for some people, right now is perhaps the first time in history that paying off a big mortgage makes sense for a lot of people. The real question, though, is which people, which circumstances. That's the context of the OP's question IMHO.
This thread makes it real clear to me that there really isn't a right answer. Reasonable people disagree, and about something like this, where it is really about numbers to a great extent, that means to me that there is no way to know what the right answer is. Very scary.
We're in the same situation, with just about enough cash around to pay off the house, but it won't leave us with much cash left "just in case". We'll make it back, of course, over ten years or so, but is that too long to live perhaps without a strong-enough safety net?