Basically, there are 2 different size E34 diffs, the 525i (m20 or M50), 535i, 530i all have the same case and interchange with no problems. On these diffs, there are different input flanges depending on the type of transmission (5 speed or auto)- 5 speed tranny diffs have a larger flange than the auto tranny diffs. The flange can be swapped but you must be very careful to torque the pinion nut to the correct spec or risk damaging the pinion bearing.
That said, you should be able to swap the M20 525i diff right into the M50 525i- as long as they both have the same type tranny. One thing to consider is that cars equipped with ASC (stability control) all have OPEN diffs- they use the brakes to control traction to each rear wheel. I'm not sure what effect, if any, an LSD would have on the ASC system.
Bret.