They say he got into an altercation with two men about 1:40 a.m.
Police say Iavecchio pulled out a .380-caliber pistol and opened fire.
Both men were wounded and hospitalized in stable condition.
Police haven't identified them.
There was no home phone listing for Iavecchio.
City Department of Correction spokesman Stephen Morello says that Iavecchio retired as a captain in 1999 after an 18-year career. His last assignment was at the Kings County Hospital prison ward.