You now find yourself in a legalistic mess. You didn't realize that landlords do not return security deposits without litigation in small claims court. Such litigation costs more than the security deposit is worth. You also did the landlord a favor by paying money to hold over very briefly.
You should have sought help from an attorney. One of us would have told what to do and the landlord would right now have been in your shoes. Instead, you face litigation for the deposit the landlord will never refund to you.
You should consult with an attorney, licensed in your jurisdiction, who is experienced in handling matters in this area of law. A skilled attorney in your jurisdiction will know which questions to ask you about your situation in order to assist you with making an appropriate determination regarding your situation.
This is not legal advice. This response is provided for general information only, as a public service. It is not to be relied upon as legal advice and does not create an attorney/client relationship; nor is it an attempt to create an attorney/client relationship. Consult with local counsel in your jurisdiction about the specifics of your case, which is the only way to gain true meaningful legal guidance and/or representation.
After the lease expired, you became a month-to-month tenant, but the terms of the lease (other than expiration date) still control - this includes late fees.
Security deposits, however, should not to be used to offset those fees / rent.
Sit with a local attorney to review the docs and render an opinion whether it makes sense to litigate.
I may be guessing or not licensed in your state. No atty/client relationship exists.