I had never thought about the matter, so I was surprised by what had happened.
I had thought the matter would have a different outcome, so I was surprised at what had happened.
1. Assume you expected a person to arrive, but you didn't expect him to arrive so early. What would you choose to say:
I was surprised by/at his early arrival.
2. Assume you didn't expect a person to arrive. What would you choose to say:
I was surprised by/at his arrival.