I half write a reply and along comes teflon to say pretty much the same thing! Anyway, might as well post my burblings...
Yes, I think you might be over-thinking it a bit!
I'd go for the latest of those flights, i.e. the last BMI flight (BD65) - might as well maximise your time in Edinburgh I'd think.
I wouldn't say there's any real difference between T1 and T5 in terms of getting back late to central London - the last tube from T5 (at 23:42) is the very same train as the last one from T1&3 (at 23:46), because it starts from T5 -
teflon has provided a link to the useful PDF of the first and last trains on the Piccadilly line.
(One quick thing I would say to teflon is that T1&3 is going to have a slightly more frequent tube service at this time just as it does throughout the day, because it also benefits from the trains coming round the T4 loop which then head back to central London - if you're mad enough to be trying to follow my ramblings lindaiah I'd suggest a quick glance at the bottom left-hand corner of the Tube map to see what I mean - however T5 retains its 10 minute service frequency right up to the last tube train, so I really wouldn't rate this concern as being important vis-a-vis the choice of terminal to fly into.)