There is no ideal moment to stop application support, but constant auditing will allow you to make forecasts and calculations. When the cost of maintaining a product exceeds its profitability, it becomes unprofitable. Please don't wait until it happens; take action early. A good software maintenance company can take care of it as well.