In your first photo, turn the connector over to see the two ridges on the other side. These are beside the holes frr Pins 1 and 3, with the Pin #4 hole beyond the ridges. Now, Pin #1 is Groiund, and Pin #2 is the +12 VDC supply to the fan. Those are the two lines you need to connect. On the old fan, the BLACK is Ground, RED is +12 VDC. On the new fan, you do NOT connect either of the wires from Pins 3 and 4, but do not leave them loose. Cut those two shorter and insualate the ends separately, then ensure they are tucked safely aside so they cannot get cought in someting inside the PSU.
You MIGHT want to consider this factor, though. The AER P140 is a 4-pin PWM style fan which CAN be controlled simply by varying the voltage supplied to it, and that is what the PSU's internal control system will do. But that's not quite ideal, and instead you could use an older 3-pin style of fan for this job. Connections would be exactly the same. In fact, on a 3-pin fan the wires will be coded differently: Pin #1 Black Ground, Pin#2 Red +12 VDC, Pin #3 Yellow speed.