Is it one side over the other that it does this on? If so, try swapping the flipper button opto boards, and see if the problem follows. If it does, it can be a dirty opto, but will more likely be a intermittent opto that has cracked solder joints. If this is the care, reflow the tiny opto solder joints for each, and the headers for the connector.
Report back.