Lens aperture is just one of several factors that determine the depth-of-field.
Point of focus, lens focal length, even the physical size of the image sensor in the camera all affect DoF and have to be considered.
DoF is probably the single most difficult photography concept for new photographers to come to grips with, because many factors influence DoF.