The lambda sensor has probably shown up in the faults as it was unplugged without properly disconnecting the battery/putting the BSI/ECU to sleep.I'm struggling to work out how a head gasket change would result in the lambda sensor flagging up. Maybe it's me, and someone can enlighten me?
But it is not difficult to damage them when removing/replacing heads/exhaust manifolds/exhaust system. They are not the most robust of components when banged around.
They also do not often react well to excessive water/oil going down the exhaust [e.g. blown head gasket] or to excessively out of spec exhaust fumes [very rich/lean].