A search for a heavy W resonance decaying to one B or T vector-like quark and a top or bottom quark, respectively, is presented. The search uses proton-proton collision data collected in 2016 with the CMS detector at the LHC, corresponding to an integrated luminosity of 35.9 fb(-1) at 13 TeV. Both decay channels result in a final state with a top quark, a Higgs boson, and a b quark, each produced with significant energy. The all-hadronic decays of both the Higgs boson and the top quark are considered. The final-state jets, some of which correspond to merged decay products of a boosted top quark and a Higgs boson, are selected using jet substructure techniques, which help to suppress standard model backgrounds. A W boson signal would appear as a narrow peak in the invariant mass distribution of these jets. No significant deviation in data with respect to the standard model background predictions is observed. Cross section upper limits on W boson production in the top quark, Higgs boson, and b quark decay mode are set as a function of the W mass, for several vector-like quark mass hypotheses. These are the first limits for W boson production in this decay channel, and cover a range of 0.01 to 0.43 pb in the W mass range between 1.5 and 4.0 TeV.