Brooklyn appeals court throws out gun possession charge, cites ineffective counsel