Before you replace the O2 sensor, pull your spark plugs to see what kind of combustion is going on. If they're fouled or wet with fuel or oil, you'l need to address the cause of that first, or your new O2 sensor will again be damaged. Sometimes the sensor just goes bad, but more often something else has caused it to fail.
The harness for the sensor twist locks together, so it's nearly impossible for it to get unplugged. Plus, if it were, you'd also get a code 1264: O2 sensor heater circuit failure.