I would suggest not combining the 2. Xanax already very potent amnesiac effects and ambien is known to cause sleep walking. Who knows what you could do in that state of mind...it wouldnt be very good I can tell you that. Not to mention that combining 2 sedatives will significantly increase your likelihood of OD from respiratory depression.
Do you take these on a regular basis or are you just in luck at the moment?