Use a spudger to pry the fan connector straight up and out of its socket on the logic board.
It is useful to twist the spudger axially from beneath the fan cable wires to release the connector.
The fan socket and the fan connector can be seen in the second and third pictures. Be careful not to break the plastic fan socket off the logic board as you use your spudger to lift the fan connector straight up and out of its socket. The layout of the logic board shown in the second picture may look slightly different than your machine but the fan socket is the same.
Lift the side of the logic board opposite the ports out of the upper case.
Rotate the logic board away from the upper case until the ports clear the lip molded in the upper case.
Pull the logic board and MagSafe board away from the edge of the upper case as one piece.
The MagSafe board may get accidentally disconnected during this process. As a precaution, be sure the MagSafe board connector is securely seated in its socket before lowering the logic board back into the upper case.
Before lowering the logic board back into the upper case, be sure the left speaker and microphone cables are seated in their channels cut into the upper case (as seen in the third picture).