It's been a while, so I had to look. It seems she was actually interim mayor, and was then recalled as interim mayor. After she was recalled, she won the special election.
Good catch; I remembered she wasn’t elected as an incumbent, and found a reference to Farrell as interim mayor at the time, but hadn’t recalled all the preceding mess.
I presume there was a line of succession like we have for the President and other public offices for these contingencies. Sure, she's had relationships with city officials like Mohammad Nuru, but I didn't get the sense that there was any corruption around her succeeding Ed Lee.
When Mayor Lee died, Supervisor Mark Farrell became interim mayor.
London Breed won the subsequent special election to become mayor.
EDIT: Actually, as noted downthread, its more complicated. But Breed’s stint as acting mayor did not immediately proceed her time as elected mayor.