Shan Masood's run out was denied after a bizarre series of events in Yorkshire's Vitality Blast match against rivals Lancashire.