〜ところだった
nearly, almost (but didn't)
Verb dictionary form + ところだった (often with もう少しで)
Sign up free to review this point on a spaced schedule.
ところだった means something almost happened, but didn't: 寝坊して、遅刻するところだった, "I overslept and nearly ended up late".
It's the past of ところだ ("about to"), and it follows the dictionary form. It's often paired with もう少しで ("a little more and") or 危なかった ("that was close"): もう少しで車にひかれるところだった.
It's usually for narrow escapes from something bad. With a condition, it describes what would have happened: 電話してくれなかったら、約束を忘れるところでした.
Compare はずだった ("was supposed to"), which is about expectations, and かけた (N2), "started to, nearly". Remember the dictionary form: it's 遅刻するところだった, not 遅刻したところだった, which means something else.
Examples
寝坊して、遅刻するところだった。
I overslept and nearly ended up late.
もう少しで車にひかれるところだった。
I was very nearly hit by a car.
危なかった。財布を忘れるところだった。
That was close. I nearly forgot my wallet.
電話してくれなかったら、約束を忘れるところでした。
If you hadn't called, I'd have forgotten our appointment.
気づかなかったら、大変なことになるところだった。
If I hadn't noticed, it would have been a disaster.