What is a good gents' hat to wear while cycling in formalwear?
My instant reaction to this is the Deerstalker. Paired with an appropriate cravat this should be able to carry you through the majority of social functions. Tweed being an obvious material for the outdoors.

Depending on how formal you need to go, you might consider a collapsible top hat, which can be changed into on arrival.

Finally, if feeling quirky, a Coke hat would be a viable alternative with the benefit of providing a conversation piece.