When Sacramento joined the ranks of cities suing Wells Fargo & Co. over allegations of discriminatory mortgage lending practices, it turned last month to a lawyer at a small firm in San Francisco who has become a familiar foe for the bank.

Yosef Peretz, of Peretz & Associates, first sued Wells Fargo in 2010 in the U.S. District Court for the Northern District of California, where he represented a fired employee who accused the bank of opening accounts without customers’ permission—the same conduct that would arise six years later in the bank’s $185 million settlement with federal regulators and the Los Angeles City Attorney’s Office.