First, don't miss going to court :)
My thoughts, as I have been involved in several such "software ownership" wrangles.
Basically the objective is to prove what intellectual property is yours and what is theirs. They will probably say we came up with the business processes and paid the developer to write it for us. In that case you got paid to do a job which you did. It ends up being the companies. It is like someone coming up with the blue print to some device then sending it to china to be built and paying the Chinese. In this case the Chinese do not own it and were paid to build it. So if they have a full spec sheet which they came up with and you developed to the letter and agreed to be paid for it then it will be a hard one.
BUT:
You can own part of it if you were not paid for developing it; you therefore own the share equivalent to the to the "sweat" you put in. What the sweat is worth is debatable, but I'd go 50:50 - you can do it the professional way of getting KPMG to see what it is worth to build it vs what it is worth to come up with the idea - they'd probably also go 50:50
If you were paid to develop it, but were also involved in conceptualising it; part of your IP is in the software. As to what your part is worth is also grey and debatable.
When it gets heavy, I usually let them have it and grab what I can on payments, and give them the source code. Being a developer you can always build another one, this time with the proper database table structures that you've always wanted to change :) - in the end a car is a car, and many companies build the same thing; but with different technologies.
Also, trust me, the system will die a natural death if the original developers are not there, and new requests, edits, upgrades are not easy to implement on someone else's code (unless of course they hire your team). Also if the software is highly specialised, you probably won't be able to on sell it to another client, but you will always have the "i developed this" on your CV. If they manage to take it and come back for a support contract; you can hit them on that.
If they were clever; they'd go the 50:50 route; open a separate company with equal shareholding; then move the IP there and on sell to themselves and competitors and use the data to their advantage ;) they can always justify the fees they paid you initially.
I'd like to know how the court case goes. They seem to be quite connected tho. Good luck :)
You might also want to release it as opensource before you go to jail ....
My two cents...
ᐧ