Narrow escape when excavating without leader (4,5)
I believe the answer is:
near thing
'narrow escape' is the definition.
(something which nearly went badly)
'excavating without leader' is the wordplay.
'excavating' becomes 'unearthing'.
'without leader' means to remove the first letter.
'unearthing' with its first letter taken off is 'NEAR THING'.
'when' acts as a link.
(Other definitions for near thing that I've seen before include "dangerous" , "Lucky escape" , "Something that barely avoids failure or disaster" , "Narrow escape, missed by a small margin (4.5)" , "Knife-edge event" .)