The magnetic and magnetotransport properties of the oxygen deficient perovskites, SrCo1-xMxO3-d with M = Nb and Ru, were investigated. Both Nb- and Ru-substituted cobaltites are weak ferromagnets, with transition temperatures Tm of 130-150 K and 130-180 K, respectively, and both exhibit a spin glass behavior at temperatures below Tf = 80-90 K. It is demonstrated that there exists a strong competition between ferromagnetism and spin glass state, where Co4+ induces ferromagnetism, whereas Nb or Ru substitution at the cobalt sites induces magnetic disorder, and this particular magnetic behavior is the origin of large negative magnetoresistance of these oxides, reaching up to 30% at 5 K in 7 T. The differences between Nb- and Ru-substituted cobaltites are discussed on the basis of the different electronic configuration of niobium and ruthenium cations.