You are using glFrameBufferTexture, when there is a glFrameBufferTexture3D. EDIT: apparently the 3D variant is deprecated in favor of the function you are using, but it is still unclear to me what you are trying to accomplish.

I am implementing Light Propagation Volumes right now, there I have some 2D Textures which are accumulated into one 3D texture. To do this I have to write into a 3d texture or a 2D texture array which is more or less the same when it comes to the implementation. And for this I need to set gl_Layer to assign to which slice of the 3d texture I want to write.

And yes you are right it is possible to use gl_Layer for cubemaps, but one can use this aswell for 3d textures. I have working and understandable example code right now but I have to adapt it to my program. And then I have to find out where the difference is to my version.