Blain - the phrase “I want it to move forward” is pretty vague, particularly considering you are working with a spaceship. I’m going to assume that you want your ship to fly like a plane, i.e. you want it to fly along the reoriented Z axis (roll axis). If this is true, try the following:
glRotatef (pitch_angle, 1,0,0);
glRotatef ( roll_angle, 0,0,1);
glTranslatef (0, 0, distance);
If this doesn’t work, try switching the order of the rotations. Using this approach you don’t have to explicitly compute the direction vector. The translation and spaceship will be reoriented by the rotations. This only works if you want the ship to move in a straight line along the spaceship’s Z axis. Good luck.