Unity sometimes misses Mouse Button Release

currently running into a weird issue.
Imagine you have this code:

private bool Mouse0Pressed = false;
public void Update()
{
    if(Input.GetMouseButtonDown(0))
    {
        Mouse0Pressed = true;
    }
    if(Input.GetMouseButtonUp(0))
    {
        Mouse0Pressed = false;
    }
}

In some random situations ( 1 out of ~100) Mouse0Pressed stays true after i release the mouse button. Interesting enough Input.GetMouseButton(0) also returns true in that case which implies to me that Unity missed the MouseButtonUp event. Both states reset to the correct value if i do another click but stay true until then.

Does anyone know if this is a known issue? could not find any info on that. Kind of lost in that regard.

My first instinct would be to monitor your mouse with some third party sofware, to see if it might be an hardware issue.

Edit, the following is apparently wrong. Read @rage_co o comment below for more information:

This is just an assumption, but I think Unity actually checks if your mouse is pressed or not. If it was pressed, and is not anymore, then Unity calls the "MouseUP once.

This means, even if Unity would “miss” the MouseUP in one particular frame, it does not matter, since it would just check again in the next frame.

If this is true, then it must be your mouse that still sends the input.