I was seeing my Yaris Verso VVTi 2NZ-FE engine and a cable was hanging (with light grey connector, 4 pin socket, and a single wire line) that is not connected anywhere. I tried to search for the socket but could not find it. It supposed to be disconnected?
That looks like the oil pressure sensor wire and plug. The weird thing is that I don't see the connection on the block behind it. You might look around and see if you can find a plug similar to the one shown in this image. It should be above/after the oil filter, because it's detecting the pressure of the oil being pumped through the filter.
You should also check for a broken plug which is screwed into the block but has the plastic plug part broken off of it. After a few years, those plastic clips often become brittle, especially when exposed to heat, and can be easily broken. If that's the case you'll probably need to buy a new oil pressure sensor, or figure out a hack job to connect the wire to the broken one.