I had this same issue last year. Ball would lock properly most of the time. Then, after first ball was put in play, locked ball would release giving unearned two ball multiball.
At first it looked like the plate/ball guide the ball rests on when locked was loose and not holding the ball high enough on the playfield to adequately block the opto. Further inspection and testing revealed that the ball still was not being held high enough up the playfield to allow the ball to properly block the opto.
My solution was to place two strips of 3M double faced foam tape across the surface of the plate/ball guide the ball rests on when locked. They ended up pushing the ball higher up the playfield by about 1/8" and creating a positive block to the opto signal.
This may not be the solution for you but it is very easy to test with a piece of thin weather strip or cardboard or whatever to push the ball higher on the guide in the locked position.
Good luck and let us know the results of your testing.
***UPDATE *** My solution above was for a different problem. Glad no one saw it and called me out on it.