Quick tip for those looking for a replacement when dealing with a camshaft sensor connector - the MAF connector (4-wire connector on the air meter after the air filter box) is the same.
These are easier to find when scouring donor cars...just be sure to locate the newest year model you can so you don't go to all the trouble just to learn you've swapped one brittle connector for another. To check a connector like this to see if it still has service life - with the connector removed, simply press in on each tang until it bottoms. If it is brittle, it will snap and you know to keep looking for another.
To repin one of these, first remove the thin red locking plate - it comes straight out. I then use a toothpick to probe and unseat the individual wire connectors, going in on the same side as the red locking plate previously occupied. Make note of the wire colors and order before disassembly!
Each wire should be fully inserted when reassembling...you should hear/feel a slight click when the connector end is fully plunged into the socket...they are usually indexed and go in one particular way - test by pulling gently on the wire to confirm it will not come back out. Make sure to use the same wire bundle gasket (grey in this case) and same connector gasket (red in this case). As Duffy noted, apply a small amount of dielectric compound to the pins/connectors, put it all back together and confirm the connector is fully seated.