In this paper we propose a beam-switching scheme to increase the reliability of the millimeter wave (mm-wave) communication links which are intermittently blocked. We assume that the blockage statistics between the UE equipments (UEs) and the base stations (BSs) change over time. As a result, the data-rates at the UE from different BSs depend not only upon their proximity but also are governed by the blockage dynamics. We model the scenario as a two-armed bandit problem, where playing an arm is analogous to the UE switching the boresight direction of its mm-wave directional beam towards one of the possible BS. In this two-armed bandit problem, we employ a Thompson sampling (TS) algorithm with parameter reset, to enable the UE to select the serving BS. The rewards considered in the algorithm are the spatio-temporal average data-rate coverage probability experienced by the UE, obtained using tools from stochastic geometry. We show that the proposed algorithm outperforms the classical received signal-strength indicator (RSSI) based association scheme in terms of the average rate-coverage probability. The proposed scheme is able to track the changing vehicular blockage dynamics and opportunistically switch between the BS links to maximize the rate-coverage.