That is actually what have happened to mine - after installing the new sensor the connector wire snapped.
Push the two pins backwards then the two wires clamped against the pins came out with rubber insulation which was inside of the green plastic outer shell of the connector.
Broke the black rubber, removed the wires carefully from pins, soldered new wires to the pins, inserted back into the green plastic connector and filled the empty gap where black rubber was with Shoegoo in black - not sure if it is heat resistance though.
Then soldered the new wires with the connector to the healthy part of the wires on the car, phew.
Also noticed that to install the sensor, I needed special sensor wrench or crowfoot wrench, otherwise the top plastic part of the sensor will be broken like my old sensor.