Mavs beat Heat in thriller; it's now best of three