Unfortunately the old saying - "you can't fight city hall" - really applies in this case. I can only assume that when the state refunded your payment, they had still not processed your amended return and were still basing your taxes on the original return that you submitted. In any case, even though they were somewhat negligent in delaying the process of your return, you are still liable for the taxes. However, you certainly should not be liable for any penalty for late filing or late payment, and it sounds like you have the paper trail to back up the fact that you did originally pay this when it was due.
If this answer has been helpful to you, please press the "accept" button. Positive feedback is also greatly appreciated. Thanks for the question and have a great day.