とこだった

was almost about to

→ ところ
phrase Rare #22,980
was almost about to Colloquial contraction of ところだった. Used when something nearly happened, often with an undesirable or dangerous result that was narrowly avoided.
JA: もう少しで電車に乗り遅れるとこだった。
EN: I almost missed the train.

トム殺されるとこだった

I almost got killed by Tom.

死ぬとこだった

I almost died.

— 雪山の絆 (2023)

家まで燃やすとこだったのよ

I almost burned the house down!?

— ニュー・シネマ・パラダイス (1988)

出かけるとこだった

Were you just about to head out?

— 恋する惑星 (1994)

危ないとこだった

That was a close one.

見逃すとこだった

I almost missed it.

— サイコ (1960)

命を落とすとこだった

I almost lost my life.

— 炎628 (1985)