V41 N20E (coarse aligns the IMU to zero angles)
V40 N20E (Makes the No Att light go away)
And then a new alignment from scratch, so P51 and then P52. After the P51 or P52 there would probably be a REFSMMAT uplink, but it isn't strictly required, not really part of the procedure to recover from the gimbal lock.
You could also try the rapid IMU realign procedure:
Maneuver to 0,0,0 on the GDC FDAI
V41N20E, E,E,E (coarse align to 0,0,0)
V40N20E (fine align; NO ATT lt off)
76E, 40000E, 1E (set DRIFT flag)
77E, 10000E, 1E (set REFSMMAT flag)
Do a P52 option 3 (Note that auto optics may be off quite a bit and torquing angles may be high, especially in roll. No problem as long as the star angle difference is okay.)
GDC align to IMU
how can i null all my rates to 0 with the CMC, i want to get the CSM as still as possible?