Hello,
first of all, for your chance to keep your residence permit can be important how long you lived together with your child, if it was enough to establish a strong relation. A few years are naturally a better argument that a few months. But it is something on which you have no ifluence now.
As you don't live together with your child anymore, the most important thing is that you stay in regular contact, visit your child or organize meetings, even if it must be organized with support of Jugendamt. In your relation to the child it is of great importance how you really exercise your right of child custody (Sorgerecht) or your right on contact and access (Umgangsrecht). Child support payments don't have so much weight because it is just your financial duty, you must do it if you have income, even without interest for a child.
If the mother just threatens you with revoking your right of custody or of access, it is only serious after she makes an application about it in Jugendamt or applies directly in the Family Court (Familiengericht). To win such case would not be easy for her, family courts normally only do it in very serious cases, in which they get a proof of danger for children. Anyway, the family court always makes its decision on the basis of the evaluation from Jugendamt because Jugendamt has the expertise. So your primary aim must be to make a good relation to the workers of Jugenamt and to persuade them that you are a good father whose real presence is essential for the child's well-being.
If it comes to losing your custody right (I hope not), you must make everything to achieve the right of contact and access through Jugendamt, even if you meet your child only in a company of a Jugendamt staff member.
One more thing: if you applied for a prolongation of your residence permit §25.5 and the Ausländerbehörde refuses to do it until the situation with the child is clarified, they must give you Fiktionsbescheinigung (a document that your application is under consideration). As long as you have this document, you must be treated as somebody with a residence permit.
And certainly, the best method would be to settle the problem with the child's mother, as Yusif 21 wrote. In this case you perhaps won't need any other advice. Try it if it looks possible.
Good luck!