During the day, the Sensex hit the 40,000 mark while the Nifty crossed the 12,000-level for the first time ever.
However, the indices succumbed to profit booking towards the fag-end of the session.
The 30-share Sensex tumbled 298.82 points, or 0.76 per cent, to close at 38,811.39. Similarly, the broader NSE Nifty settled 80.85 points, or 0.69 per cent, lower at 11,657.05.
IndusInd Bank was the biggest gainer in the Sensex pack, rallying 5.23 per cent, followed by Hero MotoCorp, Coal India, Yes Bank, PowerGrid, ICICI Bank, HCL Tech, L&T, Kotak Bank and Bharti Airtel, rising up to 1.56 per cent.
On the other hand, Vedanta, ITC, Tata Motors, HDFC twins, Bajaj Finance, Sun Pharma, Tata Steel, TCS, ONGC and Infosys fell up to 5.53 per cent.
Riding on a massive Modi wave sweeping through most parts of India, the BJP was set to return to power Thursday as it led in 298 seats while the Congress trailed far behind with 52, according to trends released by the Election Commission for all 542 seats that went to polls.
"Markets were initially enthused to see the election results falling in line with the exit polls. However, the run up to the D-day was so sharp that it turned out to be a sell on news phenomenon," said Devang Mehta, Head Equity Advisory, Centrum Wealth Management.
Participants would now be keen to know the future course of action for bringing the economy back on track, solution to the liquidity situation, the union budget, onset and progress of monsoon in June and most importantly the earnings trajectory, he added.
According to traders, weak cues from other global markets and a depreciating rupee also weighed on investor sentiment.
The rupee depreciated 37 paise to 70.04 against the US dollar in afternoon trade.
Globally, bourses in Asia ended in the red. Indices in Europe were also trading on a negative note in early deals.
Brent crude, the global oil benchmark, was trading 1.79 per cent lower at USD 69.72 per barrel.