Leinster survive a stirring second-half comeback from Ulster to win a thrilling Irish derby in Belfast and move above their rivals in the United Rugby Championship standings.