Aims . The purpose of this study is to examine the prediction that the deuterated H _ { 3 } ^ { + } ion , H _ { 2 } D ^ { + } , can be found exclusively in the coldest regions of molecular cloud cores . This is also a feasibility study for the detection of the ground-state line of ortho -H _ { 2 } D ^ { + } at 372 GHz with APEX . Methods . The ( 1 _ { 10 } \rightarrow 1 _ { 11 } ) transition of H _ { 2 } D ^ { + } at 372 GHz was searched towards selected positions in the massive star forming cloud OriB9 , in the dark cloud L183 , and in the low- to intermediate mass star-forming cloud R CrA . Results . The line was detected in cold , prestellar cores in the regions of OriB9 and L183 , but only upper limits were obtained towards other locations which either have elevated temperatures or contain a newly born star . The H _ { 2 } D ^ { + } detection towards OriB9 is the first one in a massive star-forming region . The fractional ortho -H _ { 2 } D ^ { + } abundances ( relative to H _ { 2 } ) are estimated to be \sim 1 10 ^ { -10 } in two cold cores in OriB9 , and 3 10 ^ { -10 } in the cold core of L183 . Conclusions . The H _ { 2 } D ^ { + } detection in OriB9 shows that also massive star forming regions contain very cold prestellar cores which probably have reached matured chemical composition characterized , e.g. , by a high degree of deuterium fractionation . Besides as a tracer of the interior parts of prestellar cores , H _ { 2 } D ^ { + } may therefore be used to put contraints on the timescales related to massive star formation .