Yes, this works.
The only conditions for using Stunning Strike are:
- you hit
- with a melee weapon attack
- You spend 1 ki point
So when you make an opportunity attack, and hit with a melee weapon attack, you can spend 1 ki point to use stunning strike.