But I think we will probably disagree on the right time to call it quits.
In my book, that is when the situation is more diffuse, like the hard-to-find bug on a real-time enterprise system with many integrations, and your team is fatigued, having spent 20 hours already trying to fix it, with no clear outlook on when it will be done.
If you keep on at this point, you run the very real risk of turning a manageable bonfire in the kitchen into a wildfire that takes down the whole neighborhood. I.e. direct contra-productivity in the form of unintended side consequences and breakages introduced by bleary-eyed programmers. Such issues can often end up putting the system down for even longer than it otherwise would be.
In a standard, non-live development situation, the effect will be less immediate, like slipped schedules and high defect counts, sometimes turning into the classical "deathmarch" project where there is a constant feeling of one step forward, two steps back.
The risk and impact of course varies a lot from situation to situation, so just to be clear I am not categorically stating anything here: Calculated risks can be okay, and everything has exceptions, especially when it is a production / sysops crisis versus a development deadline crisis.
If that is a recurring theme then there is definitely a deeper problem but on occasion things go wrong and 'going home' really isn't an option.
Count your blessings if you are not stress resistant and are working in a line of business where these things don't matter.
Production problems have a habit of not announcing their arrival dates, and some of those can be surprisingly hard to track down to their root cause.
Working until the problem is fixed in those situations has nothing to do with 'showing commitment' it has everything to do with being committed.
There is a right time for knowing when to call it quits and there is a right time for pushing on until the lights are back on.
You simply can't categorically state that it is wrong to push on, it depends on what is on the line and the capabilities of the people involved.