Maryland survives thriller against UVA