If you swear in anger at a customer, you can be fired instantly. Even if the customer swore at you first. Reason being that the customer's feelings about the company/staff they're buying a service from should be allowed to be known, ideally in a less blunt way but, in effect, the customer's feelings are king. A company should never have negative feelings about one of its customers, unless that customer is personally threatening the safety of staff. The most negative you should secretly think is 'How can I amicably end this conversation as soon as possible whilst having resolved any reasonable requests from the customer to the best of my/our abilities, and hopefully making that customer feel better about our company, me, or even about themselves e.g. if that customer is happier about company that customer is going to be happier about their own decision making in choosing our company?' If a customer badly swears at you, either accept it or ask them to rephrase. You can even ask them why they said it or to subtly insinuate that you're hurt if it was that bad. But never swear back. A company that cares about its staff might allow you to hang up immediately in such a case. Or to insist that you put them on hold (while hoping that they hang up whilst you're telling your manager what has been said to you).
All that said, if you're talking about having made a mistake, a deliberate 'mistake' that benefitted you by avoiding an awkward conversation with the customer can be grounds for any repetition of a similar scenario, or even that existing scenario, resulting in a final warning or even dismissal. Immediate dismissal is never off the table if your actions have been cynical towards the best intentions of the customer in a way that goes again department or company policy.
A genuine mistake is still a failing compared to the best kind of handling (from the customer's and/or the company's view) and the company should want to identify what, if anything, gave you reasonable cause to make that unfortunate mistake, what can be done to avoid it happening again, and to let you know what repercussions there would be if that mistake, or a similar mistake, happens again.