Just a quick question... Do you have the part number of Q1? Also, what's the current draw on the load you want to PWM?
If Q1 is suitably rated, and you are able to hack the circuit to disconnect the cathode of the diode from the 5V rail, you can simply:
1. Attach the cathode diode to the +40V terminal of the battery
2. Connect the ground of the circuit to the negative of the battery
3. Break the connection between the negative of the battery and the load
4. Connect the switched output from the MOSFET (confusingly also labelled ground) to the negative of the load
If Q1 is suitably rated, and you are able to hack the circuit to disconnect the cathode of the diode from the 5V rail, you can simply:
1. Attach the cathode diode to the +40V terminal of the battery
2. Connect the ground of the circuit to the negative of the battery
3. Break the connection between the negative of the battery and the load
4. Connect the switched output from the MOSFET (confusingly also labelled ground) to the negative of the load