I am very sorry to hear this, because I know how very tough the laws are if caught with a gun in one of the boroughs of NYC. Like I said, the City has its own license and doesn't evern recognize the a license in the rest of the state. Used to be that you could get five years of felony probation on a gun possession felony. Then the law toughened some years ago and the courts were calling for mandatory jail time. It has been this way ever since.
I can tell you other sad stories like yours of people who have come into -- or even through -- NYC unaware of the gun laws and assumed that if they could establish that the weapon was lawfully registered to them elsewhere, they'd escape a felony conviction. But I understand that this won't make you feel better.
I don't see anything in what you've told me that indicates you have a suit, especially as it appears you pled guilty to the charge in the first place, but it may not have to do with the gun piece but with the stop and the DWI part of the case. So even though I don't see a suit based on what you have told me, I will tell you what you need to do, and then you can sit down one on one and share the whole story with civil rights lawyer, and see after he's talked to you whether he thinks you would have a viable suit.
In order to sue NYC, if that's what the PD was suggesting you should do, for wrongful arrest or unlawful detention, you have to retain a civil trial
lawyer and file something they call a notice of claim
within 90 days of your release. That lets the city know that you plan on suing them. Once you get the notice filed, you get the regular statutory time to file the suit. However failure to file the notice on time is generally fatal, in that it will prevent you from filing suit at all. This file
from the City will explain it all.