Transition metal dichalcogenides (TMDs) such as the WS2 have been widely studied as potential electrode materials for lithium-ion batteries (LIB) owing to TMDs' layered morphology and reversible conversion reaction with the alkali metals between 0 to 2 V (v/s Li/Li+) potentials. However, works involving TMD materials as electrodes for sodium- (NIBs) and potassium-ion batteries (KIBs) are relatively few, mainly due to poor electrode performance arising from significant volume changes and pulverization by the larger size alkali-metal ions. Here, we show that Na+ and K+ cyclability in WS2 TMD is improved by introducing WS2 nanosheets in a chemically and mechanically robust matrix comprising precursor-derived ceramic (PDC) silicon oxycarbide (SiOC) material. The WS2/SiOC composite in fibermat morphology was achieved via electrospinning followed by thermolysis of a polymer solution consisting of a polysiloxane (precursor to SiOC) dispersed with exfoliated WS2 nanosheets. The composite electrode was successfully tested in Na-ion and K-ion half-cells as a working electrode, which rendered the first cycle charge capacity of 474.88 mAh g-1 and 218.91 mAh g-1, respectively. The synergistic effect of the composite electrode leads to higher capacity and improved coulombic efficiency compared to the neat WS2 and neat SiOC materials in these cells.