Play video content EXCLUSIVE TMZ.com

Gilbert Gottfried was a regular on Alan Thicke's late night '80s talk show "Thicke of the Night" and they spent a lot of time cracking jokes about Alan's singing.

Gilbert was out in NYC just hours after TMZ broke the news about Thicke's sudden death -- and he says Alan loved calling himself the "affordable William Shatner." You gotta see Gilbert's impression.

They even did an episode of "Celebrity Wife Swap" ... so they were good friends, but Gilbert clearly never nailed a spot-on impression of Alan's singing voice. 'A' for effort though.