Thanks all - lots of advice, which is what I was hoping for.
So, what have I learnt?
1 - Don't write anything in a Blog. Although the blog entry was nothing about the project, just about effective design, if the end client ever read the entry and compared it to the build, then they might wonder why it was done that way. (If anyone cares, the "offending" entry is (no longer) here.
2 - Don't put anything unnecessary in code comments. By trying to protect myself (the responsibility for ensuring the project met the build standards was mine alone), this wasn't the way to do it. I shouldn't have done it, but hindsight is a wonderful thing - unbelievably stupid given my already precarious situation.
3 - Understand everything that's in the contract. Having been given an extension of just over 5 months, I didn't anticipate getting into a situation where they would say "we're not happy" and terminate the contract. If I'd been in their shoes I would have gone the route of unprofessional conduct, which I wouldn't even think about fighting.
4 - Stop acting like a consultant and think like a contractor. I'm no longer being paid to argue over the design (even if they are so wrong!), make the point and then move on. Take the money and keep quiet.
5 - Never underestimate the reaction from permies - when you have two people giving conflicting advice and one is permie and one contractor, there's typically only going to be one winner. I completely misjudged my position - I was brought in as a recognized expert for this particular piece of work, which is why I was so concerned about the design.
I'm not completely surprised at ending the contract, it's more the manner of the way it's been done. I'm pretty sure that if the PM had spoken to me about terminating the contract, I'd have been willing to do it.
I've invoiced them for the four weeks notice (which I don't think for one second that they will pay), and will have to wait and see what they say. I'm more worried about things being presented in court that would potentially impact on my getting more work (would you employ someone who sues when the contract gets terminated??), so probably won't go as far as suing. Not really happy about it, and feel a bit of a wimp, but I now need to concentrate on getting a new contract instead of thinking about going to court over this one.
Thanks again.