After some investigation, it looks like the problem arises when locking the screen with low light (try covering the light sensor with a finger to simulate that): waving your hand over the sensor, after locking the screen that way, won't do anything...
Instead, after locking the screen when the...