It could be be unwittingly, but the word has a negative connotation as it may be related to ignorance. I'm looking for a more positive concept.
Me thinks ... serendipity. A happenstance of luck.
An example: 'I was thinking of new ways to engage with my audience and with a bit of serendipity and inspiration the cake was born.'