Maybe “A Case of Immunity”? The King is hiding behind a curtain (or wall) and comes out after the murderer admits his guilt to Columbo. No gun is pulled, though.
Butterfly In Shades Of Grey has a similar ending, but outdoors. Some cyclists are blocking the road and when Columbo and Fielding Chase pull over to help, Columbo explains to Fielding Chase how he knows he committed the murder. Chase is about to shoot Columbo when the cyclists return and are revealed to be undercover police officers. They immediately arrest Chase for murder and one count of having the most hideous mustache since WWII.