When you enable pattern lock on a phone you will also be asked for a pin in case of such situations but if you did not set up a pin then you can use the recovery function that appears when you fail to unlock the phone. If you choose that option a pin will be emailed to the address attached to the phone. Use that pin to unlock the phone. Alternatively, you will need to factory reset your phone from the Recovery menu to wipe all the settings. Please go through the manual of your phone for Recovery options.