Turn over both timers. After 4mins turn over the empty "4min" timer. After another 3 mins the "7min" timer is finished and the "4min" timer has 1min left in it. Put eggs in to boil at this point. Wait 1 min for the "4min" to finish then turn it over. 4mins later when its finished (now 5mins in to the eggs boiling) turn it again and wait the final 4 mins.
Flip both timers over at the start. Flip the 4 minute one back over as soon as it ends (3m left on 7m timer).
Once 7m timer ends flip it over again, 1m left on 4m timer. Flip 4m timer over again when it ends, 6m left on 7m timer.
When the 4m timer ends, put the egg in - 2m left on 7m timer. Flip 7m timer over again when it ends, take egg out once it ends again, for a 9 minute boil.
For the original problem I will use fractions to depict the minutes of sand in the top and bottom of the two hour glasses.
Add the egg and flip both glasses over and let the sand in the 4 minute time run fully, after 4 minutes the glasses are:
0/4 and 3/4 - 4 minutes has passed
Flip the 4 minute glass over and let them run until the 7 minute glass has fully emptied, which will be 3 minutes and the glasses are now:
1/3 and 0/7 - 7 minutes has passed
Flip both over and let them run until the 4 minute glass has fully emptied, which will be 1 minute and the glasses are now:
0/4 and 6/1 - 8 minutes have passed
Flip the 7 minute timer over and when it fully empties 1 more minute has passed for a total of 9 minutes.