Inclusive charm and beauty cross sections are measured in e-p and e+p neutral current collisions at HERA in the kinematic region of photon virtuality 5 ≤ Q2≤2000 GeV2 and Bjorken scaling variable 0. 0002≤x≤0.05. The data were collected with the H1 detector in the years 2006 and 2007 corresponding to an integrated luminosity of 189 pb-1. The numbers of charm and beauty events are determined using variables reconstructed by the H1 vertex detector including the impact parameter of tracks to the primary vertex and the position of the secondary vertex. The measurements are combined with previous data and compared to QCD predictions. © Springer-Verlag / Società Italiana di Fisica 2009.