Him locking you out the flat is an illegal eviction. Phone the police and explain that to them and they will arrange for you to be let back in the flat.
Don’t tell them you’re not on the lease, if they ask say yes. A lease can be a verbal agreement in Scotland so say it’s that if they ask.