Diode IFSM to duty cycle extrapolation?
Your assumptions are basically correct. 100 mA for 10 uS, then off for 15 uS would provide for a 40 mA average and not exceed the specs.
It's always good to "derate" your stuff. A 1/4 watt resistor would normally not carry more than 1/8th watt in normal operation, and your 40 mA diode would carry maybe 20-30 mA on average. There is no hard and fast rule to derating components, it's all a balance of cost, lifespan, availability of parts, PCB area, etc. In the end, it is usually just a guess by the engineer.
Resistors are often derated 50% on power, electrlytic caps are derated 30-50% on voltage, CPU's are almost never derated on clock frequency. Diodes are derated in the neighborhood of 25-50% on power or voltage. Of course, if this is a one-off project where failure isn't terrible then don't derate at all! :)