Craig Miles and Olly Hannon-Dalby took three weeks apiece as Warwickshire claimed a thrilling final-day victory against Middlesex at Lord’s.