を聞いて驚いた

was surprised to hear …

→ を
phrase Uncommon #14,231
was surprised to hear … を marks what was heard; 聞いて驚いた means that someone heard it and was surprised.
JA: 彼女はその知らせを聞いて驚いた。
EN: She was surprised to hear the news.

私は彼の失敗を聞いて驚いた。

I was surprised to hear about his failure.

彼は殺人事件のことを聞いて驚いた。

He was shocked to hear about the murder.

きっとあなたは私が結婚したことを聞いて驚いたことでしょう。

You must have been surprised to hear that I got married.