Violating a law is "illegal" in the sense that it may result in penalties prescribed in that law.
Violating a contract is "illegal" in the sense that it may result in contractual penalties, generally limited to compensation of the damages, possibly with punitive tripling; but it may and should be done if the contract has gone so bad that it's better to face the consequences rather than fulfill the contract.
Violating ToS (which is not even a contract) is "illegal" if you really stretch that term; it may result in losing access to that service, and nothing else (excepting certain US-only legal perversions like CFAA which happily don't apply for most people in the world), so you may do that if the benefit outweighs continued access to that service.