There are parts to your description that make understanding what is really going on very difficult if not impossible. The outlet model indicated has three 230V receptacles and two USB outlets. Each 230V receptacle can be individually controlled. The USB outlet pair is controlled as a group. Therefore there should be four relays involved. It sounds like you are saying one of the mains rated relays, “Relay 1”, is not operating. This implies the relays for the other two main outlets and the USB outlet pair are being controlled with no issues. Is that true? That would be an important piece of information.
Writing, presuming Relay 1, “If I ground one Relay contact, outlet (socket) works perfectly.”, is confusing. Relay contacts refers to the load side of a relay, not its control side, ie. its coil. I am assuming these are mechanical type relays. These are probably 5 volt relays. Outlet “works perfectly” could mean the outlet provides mains power regardless of a control means or it could mean that outlet is being controlled as normal like all the other controlled outlets. We would assume you are not grounding (ie applying the 5 volt power system’s ground) a relay load side contact or applying mains ground to a relay load side contact because the consequence precludes writing about it. Therefore maybe you are saying you grounded one of the relay’s coil leads. But if “works perfectly” means everything as normal, then the problem is due only to the relay somehow loosing its ground connection path, which seems very unlikely to happen except maybe at its ground pin solder connection to the PCB board. If a bad solder at that location is the case then that location has to be where you applied the ground. Otherwise applying the ground anywhere else for that relay coil circuit requires the solder to have been good.
Where you made this ground connection and what exactly you mean by “works perfectly” needs to be clarified. There is always a diode across the relay’s coil connections. Sometimes, but rarely, that diode is inside the relay. That diode failing partially conductive, ie acting like a resistor when it should be acting like no connection path, will shunt some control current around the relay coil causing the relay to not operate when it should. If there happens to be some resistance in the rest of the relay’s ground path, then grounding the relay coil could cause what seems like normal operation. Replacing the diode is the fix if that is what is wrong. That diode across the relay coil needs to be there. If in fact you are correct that GPIO12 controls just this relay, via a small transistor circuit on the PCB board as is typical, and if you are correct that GPIO12 is not functioning as it should, then a failed diode at that relay’s coil might be the cause for all damage. I would think what the relay coil’s diode protects against might fry just the control transistor part of the circuit and not carry back up into GPIO12.
But this is all speculation coming out of trying to understand what has been described. Please clarify.