Regarding maths, the first thing to know is that the speed value is not average speed, it is more like "cruising speed" or ideal speed. I forget exactly how it is calculated and it wasn't obvious to me when I took a quick look, but you can assume it is something like average speed (by leg score--relative to the top 3 splits) on your best half of the legs.
Any splits that are a bit slower on a relative basis won't be represented in either the mistake time or the cruising speed index, so that's what makes the difference in overall time.
Regarding the threshold for mistakes, AP is only comparing against those on the same course as uploaded, it won't compare against other common legs even if the whole course is the same. On #2, it looks like nobody was much faster in W40, and in M60 O-ing is probably just under the arbitrary criteria for a mistake (not comparing against Martina), which you can see by your low leg score
So in summary, it's all a mystery to me too :)