FALL SURVIVAL THEORY OF WING EVOLUTION
Any tree dwelling creature is at risk of falling and dying. Creatures that can better survive a fall (proto-wings, etc) have an improved chance of propagating this trait to off-spring. Furthermore, if they can better survive a fall they can risk higher climbs. The higher climbs make them better able to avoid predators and hunt prey further increasing selection pressure on fall survival and would dovetail nicely into gliding mutations. From there it is not a far jump to flying [pun intended].
No theory about the deep deep past can ever be certain. We weren't there to watch it happen.