Is it consistent?
i.e. Always works before take-off and goes out during flight at similar elapsed time since take-off???
Meanwhile, wild guesses:
Loose connector, loose part on PCB, intermittent connection on PCB- except you'd expect it to be intermittent and go out at random times.
Thermal- ESC warms up, items expand, somewhere a connection is opened until it cools down.