FB 851 then BA 462 at Heathrow
Sofia → London → Madrid
Timetable, London time
12:10FB 851 from Sofia at the gate
10:05BA 462 to Madrid leaves the gate
21 h 55 apart on the timetable, overnight
BA 462 leaves 21 h 55 after FB 851 arrives on the timetable: more than half a day, so not a connection we count.