A police officer was shot in Brooklyn Thursday night, but was saved by a bulletproof vest during the attack, cops said.