When we model aerodynamic forces like this, one of the very useful tools is a "center of pressure." The center of pressure is a point where you can pretend all of the aerodynamic forces are exerted on that point and get the correct behavior. It can move as the angle of attack (AoA) changes, meaning the angle between the vane and the wind, but at any position you can analyze it as though all of the forces are on a single point.
Note that the tail of the vane has a much larger square, compared to the triangle. It has a larger surface. Generally speaking, this means the center of pressure will be closer to the tail.
Think about what happens when the vane moves. If the vane points its head to the left of the wind, the tail is kicked out to the right. This means the tail is now a square that isn't perfectly in line with the wind. Thus the airflow will push the tail a bit to the left, "trying" to straighten it out. We can treat it as though this force was from the center of pressure, pushing the center of pressure to the left. Since the center of pressure is behind the vane's center of rotation, this will rotate the whole vane to be more straight.
When the center of pressure is behind the center of rotation, we call this a stable configuration. In airplanes the center of rotation is the center of mass, so you'll typically see stability phrased as "center of pressure behind center of mass." In our case, we're anchored to the roof, so we rotate around that instead.
So what happens if the vane is pointed backwards? If the vane is backwards and kicked to the left, the pressure on the tail (which is upwind) is to the left. Since the center of pressure is now in front of the center of rotation, this will cause the vane to swing around further, until the vane points in the right direction. The weather vane is unstable when "flying" backwards.
You can get the situation you describe, where the vane points the wrong way. Say the wind is coming from the north, and then dies down. The weathervane is thus pointing north. If the wind shifts and picks up from the south, precisely, the side to side forces are zero. However, if it shifts just a little bit off of south (and winds are never perfect), for just a brief moment, that will turn the weathervane a bit. Now, even if the wind returns to being perfectly from the south, the weathervane is no longer pointed directly north. The instability will cause the vane to swing around so that there's no longer that metastable point from the south.
In practice, the bearings on the vane are not perfect, so you have to get a wind that's reasonably far from the south before you'll actually move the vane. However, winds are also decidedly not smooth. They have small gusts which will drive the vane out of that metastable point, and then it will point in the correct direction.