Prestatyn went through to the second qualifying round of the Europa League with a dramatic 4-3 victory on penalties against Liepajas Metalurgs.