From Zelda Wiki, the Zelda encyclopedia
The Head Thwomp is the boss of the Wing Dungeon in Oracle of Ages. To defeat it Link had to throw bombs into the opening in its head. Timed correctly, so that when it stops spinning its red face is showing, damage was caused to the creature. If a different color was showing when the spinning stopped, such as blue, green, or violet, it unleashed attacks such as falling rocks or fireballs. Upon its defeat, Link was able to take the Ancient Wood.
Head Thwomp is immune to everything except bombs, and even then they can only hurt him if his red face is looking straight ahead. To defeat Head Thwomp effectively, a useful method is to wait until the face is purple, then to throw the bomb. With good timing, by the time the bomb reaches it the face will have turned red.