Here is the mistake in a much more general sense. If you (the trail) have the E advantage in a lead-trail situation, you have a decision to make in advance. Either you are going to keep your E, and separate when you know you cant follow. Or you are going to dump E to the point of equalizing energy and trail their every move. Trying to do both at the same time will end up with you in lead position.
When you have E, you should be able to dictate the flow of the fight. But when you allow the low E plane to draw you in to where there is very little separation, and still try to keep your E, you allow them to dictate the fight. If the 'lead' is good they are in effect saying "Follow me, I'll give you a nice target in a few seconds. Thats good, keep comming, closer....closer. Psyc, just kidding." The angles are already crafted, where you're not likely to make the shot. So while at face value you may think the first mistake is blowing the shot, the mistake had already happend a few seconds earlier when you didnt make a clear decision. If you stubbornly tried to maintain gun solutions until you are on top of them, you gave up your separation, and it is way to late to dump E. Hopefully you can extend out of gun range without getting tagged at that point, but if you decided either/or before you gave up separation, you wouldnt be in that prediciment.
By the way, I am not saying don't try to take a shot. I am saying take a shot if you see it, but do it with consideration to the minimum separation that you feel you can allow.