Borussia Dortmund temporarily went back to the top of the Bundesliga after a narrow victory over mid-table Mainz.