Custom Rotation for a tilted aircraft flap
If you do it this way it seems to work:


Create a bone, in the Properties panel > Data > Display, enable X-Ray (called In Front in 2.8).
Put the bone along the aileron's axis. Use the shiftS > Cursor To Selected and the shiftS > Selection To Cursor to make sure the head and tail of the bone are on the exact positions.
If you want the bone to be displayed as B-Bone, go in the Properties panel > Data > Display (altctrlS to change its thickness).
Parent the aileron to the bone With Automatic Weight.
Select the bone, switch to Pose mode, create a first keyframe with i > RotLocScale.
In the Dopesheet go to frame 20, rotate the bone on its Y axis with RYY. Create a second keyframe.
The bone should make the aileron rotate correctly. You'll have to parent the bone to the wing bone (or whatever bone that will make the aileron stick to the plane).