This strategy involves a case where 3 weighings are required. I would contend that it is impossible to handle that case without 3 weighings.
Pick 2, A and B, and weigh them against each other.
If A and B are equal, then weighI'm afraid that a solution cannot be found within the 2-weighing limit. Weigh C and D. One will be lighter or heavier - call C the lighter. Weigh A and C, if A and C are equal, then D is the odd one out and is heavier. If A and C are not equal, then C is the odd one out and is lighter.
If A and B are not equal, call A the lighter one, then pick another one C, and weigh A and C. If A and C are equal, then B is the odd one out and is heavier. If A and C are not equal, then A is the odd one out and is lighter.
Done, in 2 weighings minimum and 3 weighings maximum.