Leicester were taken to extra time by Championship Derby, but emerged as thoroughly deserved winners to make a date with Millwall in the fifth round.