Using large scale maps in C18O(2-1) and in the continuum at 1.2mm obtained at the IRAM-30m antenna with the Heterodyne Receiver Array (HERA) and MAMBO2, we investigated the morphology and the velocity field probed in the inner layers of the Horsehead nebula. The data reveal a non--self-gravitating (m/mvir = 0.3) filament of dust and gas (the neck, diameter = 0.15-0.30 pc) connecting the Horsehead western ridge, a Photon-Dominated Region illuminated by sigmaOri, to its parental cloud L1630. Several dense cores are embedded in the ridge and the neck. One of these cores appears particularly peaked in the 1.2 mm continuum map and corresponds to a feature seen in absorption on ISO maps around 7 micr. Its cdo emission drops at the continuum peak, suggestive of molecular depletion onto cold grains. The channel maps of the Horsehead exhibit an overall north-east velocity gradient whose orientation swivels east-west, showing a somewhat more complex structure than was recently reported by cite{pound03} using BIMA CO(1-0) mapping. In both the neck and the western ridge, the material is rotating around an axis extending from the PDR to L1630 (angular velocity=1.5-4.0 km/s). Moreover, velocity gradients along the filament appear to change sign regularly (3 km/s/pc, period=0.30 pc) at the locations of embedded integrated intensity peaks. The nodes of this oscillation are at the same velocity. Similar transverse cuts across the filament show a sharp variation of the angular velocity in the area of the main dense core. The data also suggest that differential rotation is occurring in parts of the filament. We present a new scenario for the formation and evolution of the nebula and discuss dense core formation inside the filament.