The only real Z Force (ok Force Z) I know of was HMS Repulse & HMS Prince of Wales when they deployed to the pacific in 1941 on their ill fated mission.
There was also a 1981/2 Australian Film starring Mel Gibson and Sam Neil called Attack Force Z which was about Australian Commandos in WW2. Maybe this was an inspiration (the timing is right)
I always assumed that the Q came from aQua! Although there was a 'Q' force in the RAF in the early 1920s defending Constantinople and the Dardenelles, and they were transported aboard ship (HMS Ark Royal). The only other naval use of Q came with the Q ships which were anti submarine ships disguised as normal merchant ships.