The Sensex, after touching a high of 18,423 in the morning, slipped to a low of 18,235.
The index finally ended up135 points at 18,289. Nifty crossed the 5,600 mark and finally ended at 5,564 -- up 42 points.
Global markets remained in the green on hopes of Greece getting a bailout package. In Asia, Nikkei added 1.5% to9,384.
Hang Seng and Seoul Composite rose over 1% each in trades.
Meanwhile, Greek officials say they have done everything asked of them for euro zone finance ministers to sign off on the 130 billion euro rescue package on Monday -- a month before Athens needs the money to make 14.5 billion euros of debt repayments due on March 20 or go bankrupt.
Foreign Institutional Investors bought shares worth Rs 184 crore on Thursday, according to provisional data available with Sebi.
Meanwhile, the rupee nudged higher in trades as the prospect for capital inflows got a boost from stronger US economic data and indications for a Greece bailout.
Most of the sectoral indices remained in the green with the BSE power index jumping 3% to 2,363. BSE consumer durables index was the top gainer with over 4% gains.
Capital goods and IT shares held on to gains.
However, BSE auto index fell 0.5% as investors booked profits after recent gains. Metal index was marginally in red.
BHEL was the biggest gainer and was up over 6.5% at Rs 303. Mahindra & Mahindra added 3.2%, followed by SBI, Sterlite and NTPC.
Meanwhile, Hero MotoCorp and HDFC were the key draggers. Hero MotoCorp was down 4% in trades. Other losers included Gail India, Maruti Suzuki and Hindalco.
JP Morgan downgraded country's wind turbine maker Suzlon Energy to "underweight" from "neutral" and cut its target price on the stock to Rs 20 from Rs 61. Suzlon was down 1.3% at Rs 29.
Shares
Markets end lower amid weak global cues
Markets dip on dismal Dec IIP data
Markets end higher led by rate sensitives
COLUMN: Bigger bandwidth for a new spectrum SCAM
House panel pushes for taxpayer-friendly code