It's not quite that simple.
But now as I understand it I have the derivative work, but does that mean that, for example, I can choose to not allow my work to be used, and force a reversion to the original work?
What happened is that you and whomever paid you did have a contract. It may not have been written down,but clearly since someone started writing you checks and you started writing code, there was some sort of agreement. You knew what to write, they knew how much to pay you.
Since it was not a written agreement, it gets very hard. If there is a dispute (which reading between the lines, it sounds like there is), then the way disputes are settled in such cases in in the courts. Either you sue them because they're using "your" code, or they sue you for their money back if you're not handing over the code you wrote, etc.
What will then happen is that a Judge will have to create a contract for you, after the fact, based on what you say, what they say and whatever evidence (email thread, logs, notes, etc). And they will decide who owns the code.
Although I would advice contacting a lawyer versed in copyright and contracts law, I have to believe that if someone gave you some instructions on what code to write, wrote checks for you to write it and then you wrote that code, it would be difficult to believe the agreement between you was anything but a "Work for Hire" agreement. A judge would look at all of the facts and then judge what would be a reasonable contract.
Although I suggest you contact an attorney (there-I've said it 4 times:)), if they paid you a reasonable rate (in the normal range for "work for hire" programming) and you accepted their money, I think you'd have an uphill case saying it wasn't a work for hire.
But to answer your question with a much more simple answer:
If you write code and get paid for it, but don't have a written contract, that does NOT mean that you automatically own what you've written.
Edit for clarification. What I should have written was: If you write code and get paid for it and don't have a written contract it does not mean that you would automatically win if you were sued (for example, if you then sold/licensed it to someone else). It was a certainly huge error on the part of the person who is paying you to not ensure that you had a contract.
Register for GameSoundCon2012 San Francisco