Catalysis of the reaction: ubiquitin C-terminal thiolester + H2O = ubiquitin + a thiol. Hydrolysis of esters, including those formed between thiols such as dithiothreitol or glutathione and the C-terminal glycine residue of the polypeptide ubiquitin, and AMP-ubiquitin.