Without some transfer of IP rights either by copyright assignment or by bare license I don't see what consideration would be for a contract to produce custom software.
If the contract is determined to be invalid the buyer can then make claims to the IP under the doctrine of promissory or reliance-based estoppel since they have built a business on the expectation that the software would be delivered with appropriate rights to distribute and modify it.
I have some clients that were gypped for a lot more than USD2.5k - they thought they were getting the IP and instead they were getting a non-transferable license to use (and the software was buggy and had - appallingly - developer backdoors and remote off-switches).
Explicit terms in contracts is a very smart move; don't assume anything about what the local version of contract and tort law will deliver to you.
Of course, off-shored development makes it all a bit more complicated - which party actually holds source code and can be sued? It's a bit of a mine-field.