He signed a contract saying he would play hockey in exchange for compensation. He didn't play, he didn't get paid. No harm, no foul.
It's almost the exact same thing as retiring, except that by not retiring he allowed the Bruins to move his cap hit.
He certainly has the right to not fulfill the terms of his contract. Since he didn't provide his agreed upon services in his fourth year, the counterparty is not obligated to fulfill their terms, and that is that.
Let's not overlook that such a move shows poor character on Thomas' part. While legal and within his rights, this type of move is not looked upon favorably in business.
He fulfilled the first three years while the terms were most favorable to him (ntc, 85% payout) and effectively terminated the agreement in year four when the terms were less favorable to him (no ntc, 15% payout of total contract). Both parties negotiated the four year deal in good faith that all four years would be fulfilled.
The team gave up term leverage in the first three years with the understanding that some of it would be gained back in year four, providing optionality for the team.
In other words, the Bruins likely would not have agreed to a three year, $17mm deal with a full ntc. They agreed to those terms with the good faith understanding that the fourth year terms would be honored.
Poor character on Tim's part. A contracter in almost any other walk of life wouldnt last long taking that approach. Obviously Tim is in a very specialized set of circumstances where that is not a cincern, but that doesnt change the fact thst its bad business and shows poor character.