Nay good night! Does anyone know where this originates?

It's still in regular use... "Nay" just means "no"... As in the good night part... I've heard this a lot... Just recently in the pub we were all having a good time and one of our group makes a terrible joke and another says "No, good night", stands up and pretends to walk out. It's just another way of saying... "No, that's enough"... Or "that's it! I've had enough"...