I think the word for this is "serendipity." Or maybe just dumb luck.