The AHRS program uses the gyro to measure relative rotation on a short timescale, then uses data from the accelerometer (for down on the roll/pitch axes) and the magnetometer (for north on the yaw axis) as absolute references to correct for gyro drift. If your yaw reading is drifting, it might be because the gyro and magnetometer are disagreeing by a large amount.
Have you run the Calibrate example from the LSM303 library to obtain calibration offsets for your board's magnetometer and updated the values of M_X_MIN, M_Y_MIN, etc. accordingly in MinIMU9AHRS.pde? If you have not, doing so should make the code behave better with your particular magnetometer.
After the magnetometer is calibrated, another thing you could try is to adjust the Gyro_Gain_Z constant (although I have not tried this myself, so I am not sure if it would work). Say you turn the board through 90 degrees of yaw. If the readings reflect a fast rotation of less than 90 degrees, then drift slowly in the same direction until it reaches 90 degrees, the gain might be too small and you should try increasing it a little. On the other hand, if the readings reflect a fast rotation of more than 90 degrees, then drift slowly back in the opposite direction, the gain might be too large and you should decrease it.
If you try this, please let us know how it turns out.