You could try the extension attached to this post:
Download sw_flatten_to_calculated_plane.rbz, and install it with extension manager. You then get a Flatten to Calculated Plane option in the Extensions menu. Select the faces that really ought to be coplanar, then choose that menu item. Undo does work, if what it did wasn’t an improvement.