Vatch,
You have not indicated the jurisdiction within which you reside, and within which your ex resides. Family Law differs in differents countries/states. Therefore you would have to check the law in the relevant jurisdicitions. Having said that, there are a few things about your account which raise questions/issues which you might want to explore:
1. If you have a joint custody order, which specifies that you should have your son living with you 50% of the time there should have been arrangements specified for the "hand-over". The Ex might have made allegations to police that she is afraid of you, that you might have threatened her, etc. If a "protection" order was made without your knowledge, and that you were arrested by Police, you should have asked to see that order, and indicate at the time of your arraignment that you had no knowledge of the order and that you wish to appeal it.
2. Had you appealed that order, and asked for a hearing you would have been offered the opportunity to lift the order, and or dispute the arrest was made without you having knowledge that you were in breach of a court order. The Judge would not have had the possibility of sending you to jail on a custodial sentence.
3. Given the fact that you received a custodial sentence, means that you were unable to take care of your son for 50% of the time during the period you were in jail. Therefore it means that your ex would be entitled to child support for the period you were unable to care for your child. However, as during your custodial sentence you were not in a position to earn money and support your child. So in essence her request for child support should have been directed to the state, and not you.
In other words your entire story sounds rather implausible. The fact that your ex is in a relationship with another man is not relevant, unless your son has told you and others that he is being abused by the new "boyfriend" or by his mother. Neither is your animosity and anger at your ex helping you make and present a coherent case that will win the support of the court and judge (who almost by definition will support mothers, and be biased against fathers). Hope this helps.