You might want to try converting the keyframes to Hold Keyframes (Highlight them/right click/Toggle Hold Keyframe.) Then see if this result is acceptable.
Check your frame rates. Comp and render must match. Purge your cache and memory. Make sure your version of AE is up to date. If that doesn't help we need screenshots of the entire app with the modified properties of the layers giving you problems revealed. Select the layers, press the U key twice and print screen and paste to the forum. If you are on a Mac Shift + Ctrl Cmnd + 3 and drag to the reply field on the forum, then show us the render settings.
Well, one-frame blips are going to be tricky on the eye. they could be perfectly there, just not show up due to screen refresh delays and other perceptional phenomena. I also agree with teh others - if you use normal linear keyframes, it could perfectly mean that both at the in- and outgoing slopes it actualyl never is 0% opacity due to the sampling or things like motionblur being calculated. At best it may look like a short flicker that gets darker. The same were to happen if you mix up framerates due to the discrete sampling steps not coinciding with teh keyframes then. You should also be wary what formats you use. It can well be that compressed formats like H.264 muddle up such stuff due to how there compression works. There's always the chance that compression artifacts from preceding frames make a mess.
Thanks for the replies.
The only way I could get it to work was to split the layer at each drop to 0%. Then I omit the one frame on the newly split layer. That renders correctly - the layer is hidden for the single frame.
I still can't explain why the opacity change doesn't work - it should be exactly the same thing. I also can't explain why the opacity change technique renders correctly in After Effects but not to a file. It's not a codec/framerate problem because the split-layer technique works when rendered to a file, so the codec/framerate can capture the single-frame dropout. Just not when you do it with opacity.
Did you try Hold keyframes?